CentOS 6服務(wù)器常用安裝命令指南
系統(tǒng)基礎(chǔ)配置
更新系統(tǒng)軟件包:
yum update -y
安裝EPEL擴(kuò)展源:
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
核心服務(wù)部署
安裝Apache Web服務(wù)器:
yum install httpd -y
service httpd start
chkconfig httpd on
部署MySQL數(shù)據(jù)庫:
yum install mysql-server -y
service mysqld start
mysql_secure_installation
開發(fā)環(huán)境配置
安裝PHP運(yùn)行環(huán)境:
yum install php php-mysql -y
service httpd restart
添加Python 3支持:
yum install centos-release-scl -y
yum install rh-python36 -y
scl enable rh-python36 bash
網(wǎng)絡(luò)安全設(shè)置
配置iptables防火墻:
iptables -A INPUT -p tcp --dport 80 -j ACCEPT
service iptables save
service iptables restart
啟用SSH密鑰登錄:
ssh-keygen -t rsa
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
系統(tǒng)監(jiān)控管理
安裝系統(tǒng)監(jiān)控工具:
yum install htop iftop nmon -y
查看實(shí)時(shí)資源狀態(tài):
top -c
free -m
df -h