Install CentOS 7 安装centos 7 Test this media & install CentOS 7 测试安装文件和安装centos7 Troubleshooting 故障修复
yum upgrade 或 yum update
yum -y install wget telnet perl perl-devel net-tools kernel-devel
yum install "Development tools" -y
yum install epel-release.noarch
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
cd /etc/yum.repos.d/
vim remi.repo
将enabled=0更改成enabled=1html
yum clean all
yum update
# uname -a # 查看内核/操做系统/CPU信息的linux系统信息命令 # head -n 1 /etc/issue # 查看操做系统版本,是数字1不是字母L # cat /proc/cpuinfo # 查看CPU信息的linux系统信息命令 # cat /proc/cpuinfo # 查看CPU相关参数的linux系统命令 # cat /proc/partitions # 查看linux硬盘和分区信息的系统信息命令 # cat /proc/meminfo # 查看linux系统内存信息的linux系统命令 # cat /proc/version # 查看版本,相似uname -r # cat /proc/ioports # 查看设备io端口 # cat /proc/interrupts # 查看中断 # cat /proc/pci # 查看pci设备的信息 # cat /proc/swaps # 查看全部swap分区的信息 # cat /proc/loadavg # 查看系统负载磁盘和分区 # mount | column -t # 查看挂接的分区状态 # fdisk -l # 查看全部分区 # swapon -s # 查看全部交换分区 # hdparm -i /dev/hda # 查看磁盘参数(仅适用于IDE设备) # dmesg | grep IDE # 查看启动时IDE设备检测情况网络 # lspci -tv # 列出全部PCI设备 # lsusb -tv # 列出全部USB设备的linux系统信息命令 # hostname # 查看计算机名的linux系统信息命令 # lsmod # 列出加载的内核模块 # env # 查看环境变量资源 # free -m # 查看内存使用量和交换区使用量 # df -h # 查看各分区使用状况 # du -sh # 查看指定目录的大小 # grep MemTotal /proc/meminfo # 查看内存总量 # grep MemFree /proc/meminfo # 查看空闲内存量 # ifconfig # 查看全部网络接口的属性 # iptables -L # 查看防火墙设置 # route -n # 查看路由表 # netstat -lntp # 查看全部监听端口 # netstat -antp # 查看全部已经创建的链接 # netstat -s # 查看网络统计信息进程 # ps -ef # 查看全部进程 # top # 实时显示进程状态用户 # uptime # 查看系统运行时间、用户数、负载 # w # 查看活动用户 # id # 查看指定用户信息 # last # 查看用户登陆日志 # cut -d: -f1 /etc/passwd # 查看系统全部用户 # cut -d: -f1 /etc/group # 查看系统全部组 # crontab -l # 查看当前用户的计划任务服务 # chkconfig –list # 列出全部系统服务 # chkconfig –list | grep on # 列出全部启动的系统服务程序 # rpm -qa # 查看全部安装的软件包
#logout #注销是登录的相对操做,登录系统后,若要离开系统,用户只要直接下达logout命令便可
Shutdown命令能够关闭全部程序,依照用户的须要,从新启动或关机。linux
参数说明以下:vim
当即关机:-h 参数让系统当即关机。范例以下:centos
#shutdown –h now ← 要求系统当即关机
指定关机时间:time参数可指定关机的时间;或设置多久时间后运行shutdown命令,范例以下:服务器
#shutdown now ← 马上关机 #shutdown +5 ← 5分钟后关机 #shutdown 10:30 ← 在10:30时关机
关机后自动重启:-r 参数设置关机后从新启动。范例以下:网络
#shutdown -r now ← 马上关闭系统并重启 #shutdown -r 23:59 ← 指定在23:59时重启动
经常使用的参数以下:less
-f 参数:不依正常的程序运行关机,直接关闭系统并从新启动计算机。tcp
-I 参数:在在从新启动以前关闭全部网络接口。ide
虽然reboot命令有个参数可使用,可是通常只须要单独运行reboot命令就能够了工具
(1)ls 用来显示当前目录中的文件和子目录列表
(2)cd
(3)mkdir
(4)rmdir
(5)cp
(6)rm
(7)more/less
(8)cat
(9)mv
(10)pwd
(11)locate/updatedb/find/which
(12)grep
(13)重定向与管道
若无特殊说明,命令的具体使用参考CentOS 6.x(RHEL 6.x)便可(后同)。
(1)mount挂载
(2)umount卸载
(1)&、bg、fg
(2)nohup
# yum -y install httpd
# systemctl start httpd.service #启动服务(等同于service httpd start)
# systemctl stop httpd.service #中止服务(等同于service httpd stop)
# systemctl restart httpd.service # 重启服务(等同于service httpd restart)
# systemctl status httpd.service #查看服务是否运行(等同于service httpd status)
# systemctl enable httpd.service #开机自启动服务(等同于chkconfig httpd on)
# systemctl disable httpd.service #开机时禁用服务(等同于chkconfig httpd on)
# systemctl list-units –type=service #查看服务是否开机启动 (等同于chkconfig –list)
说明:
使用systemctl命令,要记住start,stop,restart,status,enable,disable,is-enabled。就能够很好的使用!
CentOS 7使用的是Linux Kernel 3.10.0的内核版本,新版的Kernel内核已经有了防火墙netfilter,而且firewalld的使用效能更高,稳定性更好。
CentOS 7配置firewalld防火墙有两种方法:
systemctl start firewalld.service
方法一
cp /usr/lib/firewalld/services/http.xml /etc/firewalld/services/
firewall-cmd –reload
Add
firewall-cmd –permanent –zone=public –add-port=80/tcp
Remove
firewall-cmd –permanent –zone=public –remove-port=80/tcp
Reload
firewall-cmd –reload
其中,方法二的配置方式是间接修改/etc/firewalld/zones/public.xml文件,方案一也须要在public.xml里面新增,不然http的防火墙规则不会生效,并且两种配置方式都须要从新载入防火墙。
附防火墙经常使用操做:
systemctl status firewalld.service #查看防火墙状态
systemctl start firewalld.service #启动防火墙
systemctl stop firewalld.service #关闭防火墙
systemctl disable firewalld.service #禁止firewall开机启动
yum -y install iptables-services #须要安装iptables组件
若是要修改防火墙配置,如增长防火墙端口3306
vi /etc/sysconfig/iptables
增长规则
-A INPUT -m state –state NEW -m tcp -p tcp –dport 3306 -j ACCEPT
保存退出后
systemctl restart iptables.service #重启防火墙使配置生效
systemctl enable iptables.service #设置防火墙开机启动
最后重启系统使设置生效便可。
查看ip信息,默认使用 ip addr ,若是想继续使用ifocnfig命令,须要额外安装组件net-tools
待续~