Linux的启动过程或启动顺序
Boot sequence (important)
1:load bios(hardware information) -----------------》加电自检(bios固化在主板上的程序)
2:read MBR’s config to find out the OS -----------------》在硬盘的启动程序上,找到要启动的操作系统(有的硬盘装了好几个操作系统)
3:load the kernel of the OS -----------------》找到要启动的操作系统后,他会找系统所在的分区,并且根据系统的安装目录,找到这个操作系统的启动的核心文件
4:init process strats -----------------》linux启动的第一个进程init
5:execute /etc/rc.d/sysinit -----------------》(rc:run command;运行命令;d:deamon----精灵进程)
6:start other modules (etc/modules.conf) -----------------》把各种系统的模块load进来(内存管理的模块,硬盘管理的模块 )
7:execute the run level scripts -----------------》对于Linux它一共有7层;启动不同层次会运行相应层的脚本
8:execute /etc/rc.d/rc.local -----------------》(Tomcat自启动要修改这里的文件)
9:execute /bin/login -----------------》登陆
10:shell started -----------------》shell启动
Login_Logout_Shutdown_Reboot...
1)login
A)Terminal or Gui
2)exit -----------------》退出终端
3)shutdown -----------------》关机 (必须指定关机时间;如 shutdown now)
4)reboot -----------------》重启
5)init(run level - /etc/inittab) -----------------》运行到哪个层次(不同Linux版本不一样)
init n:
1)0 - 系统停机状态
2)1 - 单用户工作状态
3)2 - 多用户状态(没有NFS)
4)3 - 多用户状态(有NFS)
5)4 - 系统未使用,留给用户
6)5 - 图形界面
7)6 - 系统正常关闭并重新启动
命令帮助:
命令 --help
Man 命令
rm除了删目录还可以删除文件:
mkdir aa
rm dir aa
rm -r aa -----------------》这个是递归删除,但是每一次递归都会询问用户是否删除
rm -rf aa -----------------》直接强制的删除
mv d1 d2 -----------------》d1移动到d2下面去
cat 3.txt -----------------》正序输出3.txt
tac.txt -----------------》逆序输出3.txt
head -n 开始的前n行
tail -n 最后的n行
find / -----------------》从根目录下找
find /etc/ -name my*
find /etc/ -name local*
whereis ls -----------------》敲ls时它运行的是哪一个文件,以及它的帮助文档在什么位置
echo $path -----------------》查看path目录
ln -----------------》连接
Ln 3.txt 4 -----------------》创建3.txt的一个连接叫4,4和3.txt的内容是一样的
Ln和cp的区别:
关闭Linux防火墙
Service iptables stop
More vsftpd.conf
设置允许root下上传文件:
两步操作:1)删除vsftpd.user_list中的root(用#直接注释掉就行了)
2)删除vsftpd.ftpusers中的root
在文件vsftpd.user_list中列出了for users that are denied (more vsftpd.user_list)把root删除了;
重启vsftpd service vsftpd restart
Linux 中设置redhat开机自启动:
方法一、用vi打开/etc/rc.local在里面加入/usr/local/bin/vsftpd &即可。&符号表示是以后台的进程启动的。
或者
方法二、启动:chkconfig vsftpd on
chkconfig --list
只看vsftpd
利用管道实现 chkconfig --list | grep vsftpd
作业一、
关闭图形界面:
More inittab
远程登录Linux
Linux和windows服务器是分离的,为了远程登录登录然后远程管理Linux,最古老的方式是telnet目前流行ssh,(因为telnet所有的东西的传递都是明文的,没有加过密只要监听网卡上传递出去的信息就知道密码了,很不安全;ssh本身传输的过程是加密的)
1)启动ssh:
$service sshd start
$chkconfig sshd on
2)连接
客服端:putty.exe
修改颜色:255:255:255白色
解压.tar.gz:gzip -d *.tar.gz
或者 tar -zxvf *.tar.gz -C /mywork
移动目录到根目录:mv 3.text /
修改名字:mv 3.text a.text
启动tomcat:
观察当前的进程:ps -ef | grep tomcat
Service iptables stop
防火墙设置成不启动:chkconfig iptables off
Rpm:redhat package management;
Rpm -qa ——>查出所有安装过rpm的包
查找jdk的包:rpm -qa | grep jdk
卸载:rpm -e 包名称
安装jdk:rpm -ivh 文件名.rpm
Tomcat开机自动启动:
如果相位某一个用户设置单独的配置文件,在.bash_profile中设置
1)在/etc/profile中配置环境变量
2)在/etc/rc.local中设置/tomcat7/bin/startup.sh;注意这在之前需要设置JAVA_HOME的环境变量:exportJAVA_HOME=/usr/java/jdk.1.7.0.60
3)reboot
4)ps -ef | grep tomcat