常用命令:
搜索軟件
yum search package
安裝軟件
yum install package
安裝某個版本的軟件包
yum install package=version
卸載某個軟件包
yum remove package
升級某個軟件包
yum update package
源:
-- 查看源
yum repolist
-- 禁用原來無效的源
yum --disable repoid
-- 查詢是否安裝了 某個yum源
rpm -qa |grep repo-name
-- 刪除該yum源
rpm -e repo-name
yum remove repo-name
--1 首先備份
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
--2 阿里源
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
--2 網(wǎng)易開源鏡像
wget https://mirrors.163.com/.help/CentOS7-Base-163.repo
mv CentOS7-Base-163.repo CentOS-Base.repo
--2 fedora的epel倉庫(非官方源)
yum install epel-release
--3 添加好以后需要先刷新:
yum clean all
yum makecache
參考官網(wǎng)
SSH:
$ vim /etc/ssh/sshd_config
-- 做如下修改:
PermitRootLogin yes //權(quán)限r(nóng)oot登錄
PasswordAuthentication yes //密碼驗證
防火墻端口:
$ vim /etc/sysconfig/SuSEfirewall2
-- 做如下修改
FW_SERVICES_EXT_UDP="22"
FW_SERVICES_EXT_TCP="22"
--SSH自啟動:
$ systemctl enable sshd.service
--SSH狀態(tài)/重啟
$ systemctl status/restart sshd.service
防火墻:
--啟動防火墻
systemctl start firewalld
systemctl stop firewalld
--自啟
systemctl enable firewalld
sytemctl disable firewalld
自啟動:
1 vim /etc/init.d/after.local
--添加如下
/usr/local/run.sh
2 新建腳本 vim /usr/local/run.sh
--添加如下
echo "this is " > /usr/local/1.txt
3 腳本賦值 權(quán)限
chmod +x run.sh
4 重啟看/usr/local/1.txt
reboot
參考