CentOS7 最小化安装后的必备操作
生活随笔
收集整理的這篇文章主要介紹了
CentOS7 最小化安装后的必备操作
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
文章目錄
- 1. 安裝ifconfig
- 2. firewall 啟用 IPtable
- 3. 修改iptables配置文件
- 4. 重啟iptables
- 5.關閉SELINUX
- 6. 安裝wget
- 7. 安裝vim
- 8. 安裝unzip
- 9. 更換鏡像源 為阿里源
- 10 依賴必備
1. 安裝ifconfig
yum install -y net-tools2. firewall 啟用 IPtable
#停止 Firewall systemctl stop firewalld #關閉firewall自動啟動 systemctl disable firewalld.service #安裝IPtables防火墻 yum install -y iptables-services3. 修改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 ACCEPT4. 重啟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 wget7. 安裝vim
yum install -y vim-enhanced8. 安裝unzip
yum install zip unzip9. 更換鏡像源 為阿里源
這里我們就用阿里源做個示例,想用其他源的同學可以去百度一下
#先進入源的目錄 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 repolist10 依賴必備
yum install build-essential openssl openssl-devel unixODBC unixODBC-devel make gcc gcc-c++ kernel-devel m4 ncurses-devel tk tc xz總結
以上是生活随笔為你收集整理的CentOS7 最小化安装后的必备操作的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Maven依赖方式引用UEditor的j
- 下一篇: 查看git历史记录