1. 安裝 OpenSSH Server
# yum install openssh-server
設定開機時啟動 OpenSSH Server
# systemctl enable sshd.service
啟動 OpenSSH Server
# systemctl start sshd.service[@more@]2. 修改套件更新來源
# cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.$(date +%F)
將 mirrorlist 那一行的前面加上 # 註解
# sed -i ‘s,mirrorlist=http://mirrorlist.centos.org,#mirrorlist=http://mirrorlist.centos.org,’ /etc/yum.repos.d/CentOS-Base.repo
把 #baseurl 前面的 # 去除
# sed -i ‘s,#baseurl=http://mirror.centos.org,baseurl=http://mirror.centos.org,’ /etc/yum.repos.d/CentOS-Base.repo
將 http://mirror.centos.org/centos/ 替換成 ftp://140.111.74.109/CentOS/
# sed -i ‘s,http://mirror.centos.org/centos/,ftp://140.111.74.109/CentOS/,’ /etc/yum.repos.d/CentOS-Base.repo
安裝 EPEL 套件庫
# yum install epel-release
去除舊的 yum cache
# yum clean all
開始進行更新
# yum update
3.補足缺少的套件
# yum install which vim nano yum-utils net-tools bind-utils mlocate zip unzip wget iptables-services ntpdate net-snmp net-snmp-utils bzip2 lsof less
# yum install fail2ban ssmtp logwatch cronie
# systemctl enable fail2ban.service
# systemctl start fail2ban.service
4. 設定時區及預設編輯器
# tail -2 /etc/profile
export EDITOR=”/usr/bin/vim”
export TZ=”Asia/Taipei”
5. 安裝 LAMP
# yum install httpd mariadb mariadb-server php php-mysql php-gd php-pear php-xml php-xmlrpc php-mbstring php-soap
php-bcmath php-dba php-embedded php-enchant php-fpm php-intl php-mysqlnd php-odbc php-pspell php-recode php-soap php-xmlrpc rrdtool-php uuid-php php-pecl-memcache
6. 設定開機時啟動
# systemctl enable httpd.service
# systemctl enable mariadb.service
# systemctl start httpd.service
# systemctl start mariadb.service
7. 設定 MariaDB SQL Server
# /usr/bin/mysql_secure_installation