文章目錄
1. 安裝ifconfig
yum install -y net-tools
2. firewall 啓用 IPtable
#停止 Firewall
systemctl stop firewalld
#關閉firewall自動啓動
systemctl disable firewalld.service
#安裝IPtables防火牆
yum install -y iptables-services
3. 修改iptables配置文件
開放以下端口 (默認開啓了22端口,以便putty等軟件的連接,實例開啓80端口和3306端口,以便後期lamp環境使用,注:80 爲Apache默認端口,3306爲MySQL的默認端口)
vi /etc/sysconfig/iptables
#添加下面三句話到默認的22端口這條規則的下面
-A INPUT -m state –state NEW -m tcp -p tcp –dport 80 -j ACCEPT
-A INPUT -m state –state NEW -m tcp -p tcp –dport 3306 -j ACCEPT
4. 重啓iptables
systemctl restart iptables.service
添加iptables開機自啓項
systemctl enable iptables.service`
5.關閉SELINUX
編輯SELINUX配置文件
vi /etc/selinux/config
#註釋掉下面兩行
#SELINUX=enforcing
#SELINUXTYPE=targeted
#增加一行
SELINUX=disabled
保存退出後執行下面一條命令(記得重啓虛擬機,稍後設置完重啓即可)
setenforce 0
使設置啓用,在這裏最好重啓一下系統,也可以稍後重啓
6. 安裝wget
yum install -y wget
7. 安裝vim
yum install -y vim-enhanced
8. 安裝unzip
yum install zip unzip
9. 更換鏡像源 爲阿里源
這裏我們就用阿里源做個示例,想用其他源的同學可以去百度一下
#先進入源的目錄
cd /etc/yum.repo.d 或者/etc/yum.repos.d
#備份一下官方源
mv CentOS-Base.repo CentOS-Base.repo.bak
#將阿里源文件下載下來
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
#重建源數據緩存
yum makecache
ok,換源完成
#查看安裝後的yum源
yum repolist
10 依賴必備
yum install build-essential openssl openssl-devel unixODBC unixODBC-devel make gcc gcc-c++ kernel-devel m4 ncurses-devel tk tc xz