Tuesday, November 17, 2015

install linux


  1. 分区:主(一般最多四个)、延伸、逻辑
  2. /boot 必须在最前面
  3. 不同分区的大小,以及如何分区,依据系统的功能制定
  4. 一般需要etx4, swap类型的分区,当然也可以添加

file system


  1. find file system type : df -T
  2. linux & windows both support : vfat file system 

Saturday, November 14, 2015

Python Plan


  1. develop some small projects
  2. develop games 2D
  3. develop games 3D
  4. develop games interesting (how to create a game structure)

Friday, November 13, 2015

Linux study plan

basic stage (精通使用、内核基本了解):

  1. 鸟哥的书,共两册。 使用、了解linux,打好基础!
  2. UCore. 初步了解linux系统的程序开发过程以及开发工具的使用,以及较好的了解UCore系统
  3. 其他的比较好的介绍linux的书

master stage (内核深入了解、精通开发):

  1. 更多的通过实践来了解

Wednesday, November 11, 2015

Windows visual studio 2013 install MS_MPI and run mpi program


  1. install MSMPI : msmpi.  We need install both msmpisdk.msi (to get include\ & lib\) and MSMpiSetup.exe (to get bin\mpiexec.exe) 
  2. set environment variables : 
    • MSMPI_BIN=C:\Program Files\Microsoft MPI\Bin\
    • MSMPI_INC=C:\Program Files (x86)\Microsoft SDKs\MPI\Include\
    • MSMPI_LIB32=C:\Program Files (x86)\Microsoft SDKs\MPI\Lib\x86\
    • MSMPI_LIB64=C:\Program Files (x86)\Microsoft SDKs\MPI\Lib\x64\
  3. create a new C++ empty project :
  4. change linker's system configuration to CONSOLE(SUBSYSTEM:CONSOLE)
  5. add linker additional lib directories (x86 or x64) this machine is x86:
  6. add linker input additional dependencies , Type msmpi.lib to the list 
  7. add location of mpi header file 
  8.  Add a C++ file to write your first MPI program and write the following codes as a test: 
    #include<iostream>
    #include<mpi.h>
    using namespace std;
    
    int main(int argc, char** argv){
    
        int mynode, totalnodes;
    
        MPI_Init(&argc, &argv); 
        MPI_Comm_size(MPI_COMM_WORLD, &totalnodes);
        MPI_Comm_rank(MPI_COMM_WORLD, &mynode);
        
        cout << "Hello world from process " << mynode;
        cout << " of " << totalnodes << endl;
    
        MPI_Finalize();
        return 0;
    }
  9. build the program and if there is no error , then test it by running mpiexec:                        "mpiexec -n 4 mpi_hello.exe"
  10. use msmpi ; use msmpi 2 : 主要参考

local linux log in remote linux server (key pairs)

There are several ways we can do that.


Local machine:generate keys

  1. username and password : ssh username@host_ip port ; then input password 
  2. key pairs (more secure then password logging in): it's a two way method, you need to create both private key(for local ubuntu to authenticate) and public key (to transfer to the remote server)
    • create a new folder : mkdir ~/.ssh
    • ssh-keygen -t rsa ; then we will find two files : id_rsa and id_rsa.pub in .ssh/
    • then transfer the public key to remote server : here is a simple command  (ssh-copy-id <username@host>) 

Remote server:upload public key

  1. make sure .ssh is existed. use "ls -al "to examine. 
  2. if .ssh not exist, then "mkdir ~/.ssh"
  3. then copy id_rsa.pub to .ssh/

Monday, November 9, 2015

Security

System Administration

Find && '/'

1,examples:


  1. find file in a specific path :  find path -name filename (find /etc/ -name java.sh)
  2. -iname : 大小写不敏感
  3. -type : 文件类型
  4. -P : 路径


2, shortcut key : /
快捷键: n (next) ; u (previous one)

Network

Make

GDB

鸟哥私房菜 服务器架设篇

鸟哥私房菜 基础篇



  1. find file system type: df -T
  2. 关于man查询有关命令式,该命令后的数字是有实际意义的

  3. man page 的主要结构

    man page 的常用快捷键

    man 查找关键词,而非相应的命令名: man -k keyword

  4. 内存的数据不会立刻存储到硬盘,而是暂时留在内存以防数据的频繁读取。所以为防止断电等意外事故造成数据的损失,应该随时执行 sync命令,讲内存中数据同步到硬盘中。
  5. fsck 文件系统修复。 如果硬盘有分区坏掉时,可以用这个命令修复该分区。
  6. 破解linux密码:单人维护模式
  7. root account is disabled by default. so, need to create a new root account to use 'su' command.
    • sudo -i
    • passwd









Git

Thursday, October 29, 2015

Detect, mount, format devices


Detect devices:
  1. lsblk : prints all block devices (except RAM disks) in a tree-like format by dafault. More clear than comman "mount"
  2. mount -l \ -a (man mount for more details)
  3. file : determine file type
  4. df -h
  5. lsusb
  6. sudo fdisk -l 

Mount devices:
  1. mount -t type device dir  
    • we can find some device in /dev/disk/.......
    • usually linux can automatically detect file system type, so we don't need "-t"
    • example: mount /dev/sdf4  /media/usb
    • if path "/media/sdf4" is not exsited, we need create a new directory to mount device


Umount devices :
  1. umount device

Sunday, October 25, 2015

Thursday, October 22, 2015

Configure local ubuntu to be accessed remotely

LAN

1, configure ssh.

  • we need ssh server to share our machine with others. ssh is usually installed in linux distributions, however , ssh server is not installed. so first , we need to install a ssh server.  "sudo apt-get install openssh-server"  
  • start ssh server with command "sudo /etc/init.d/ssh start" check if it's started using command "ps -e  | grep sshd"
  • set the port which ssh server will listen for. "vim /etc/ssh/sshd_config" there is a line starting with "Port port_number", we can change this port_number to the port we want to listen for.

2, configure firewall: iptables

  • add some rules to accept packages from other machine. "sudo iptables -A INPUT -p tcp --dport 22 -j ACCEPT " 
  • save set (method 1)(make iptables rules persistent): 
    • "iptables-save > /etc/iptables.rules" : save set in file iptables.rules
    • edit a bash file in /etc/network/if-pre-up.d/iptables.sh                                   
      • #! /bin/bash
      • iptables-restore < /etc/iptables.rules"
  • save rules permant (method 2) 
    • sudo apt-get install iptables-persistent
    • service iptables-persistent start

WAN


  1. if your server is in a LAN, and you want to access a server in the LAN from outside, then find the router of the LAN, and configure the router. Set the router to forward to forward connections to port 4015(set above) to your internal IP address.

Wednesday, October 21, 2015

Commands Learned


  1. less : see text file. one pape 
  2. file : examine file type
  3. standard input / standard output / Pipelines
  4. Permissions
  5. Job control : ps/kill/jobs/bg/fg

一些重要文件的位置


  1. iptables中各个协议及其对应编号: /etc/protocol
  2. 网络服务及其对应编号 : /etc/services
  3.  

Tuesday, October 20, 2015

Shell scripts

linux command

learn shell

alias Create a command for a linux executable file

edit the file ".bashrc" , add the below line at the bottom of the file.

"alias eclipse=/opt/eclipse/eclipse" and Do "source ~/.bashrc" to be able to use alias as a command.

**this is way like "define #"in the C/C++, when you type "eclipse",it will be replaced with the right hand side of the alias definition, which here is the full path to the executable.

Understanding more about /etc/profile and /etc/bashrc

examples

alias gquit="gnome-session-quit" (we can use a short word to replace the long command in this way)

Sunday, October 18, 2015

Saturday, October 17, 2015

tools in linux

  1. setup bootable usb : unetbootin (sudo /usr/bin/unetbootin)

Hack Windows passward

  1. Bootablelinux USB && boot some flavor of linux live USB
  2. Navigate to system32
  3. Rename Magnify.exe : find magnify.exe, and rename it to magnify.old
  4. Rename cmd.exe : find cmd.exe, and rename it to magnify.exe
  5. shutdown ubuntu and reboot Windows
  6. Get CMD Prompt Modify Accounts : Ease of Access : click "magnifier" and hit "apply"
  7. get an cmd seesion, type "net user" to get a list of accounts.                           My Options:                                                                                                        Change PWD : "net user username new_password"                                          Add an account : net user username password /add                                         Admin that : net localgroup administrators username /add                             Deltet that : net user username /delete                                                              net user systax reference                                                                          
  8. Reboot linux and Fix magnify.exe : repeat step 1 && 2 && 3, then rename magnify.exe to cmd.exe , rename magnify.old to magnify.exe


reference : clever method

Friday, October 16, 2015

Ucore Course tools

Spending two months finishing Ucore Class and Ucore labs.
Then I will take MIT OS class. Meantime hoping to do something about sensor and hardware.

install grunt in ubuntu 14.04  : it's wrong according to the official website.

Git 


Thursday, October 15, 2015

Apache2

learn about how to configure with apache2 and learn about apache.

References:
Apache2 Ubuntu Documentation
Apache2 Documentation : contains in depth information on Apache2 configuration directives. Also, see the apache2 doc package for the official Apache2 docs.
Mod SSL Documentation : site for more related documentation
Apache Cookbook




Tuesday, October 13, 2015

Linux boot


Linux File System Standard

File System Standard

Linux Online Emulator

一个叫Fabrice Bellard的工程师使用 JavaScript 在浏览器上模拟出了一个 Linux 系统。没有图形化界面,完全使用命令行的方式与之互动。Linux操作系统内核版本为2.6.20。具体使用过程中可以参考jslinux:的


FAQ:http://bellard.org/jslinux/faq.html 

技术说明:http://bellard.org/jslinux/tech.html