1.yum源
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup 备份旧的,修改成国内源。
wget下载源
#163的源:
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo
#阿里云的源
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
#这个地址由系统决定,此处为centos7
建立缓存
yum makecache
把服务器的包信息下载到本地缓存起来,配合yum -C search xxx
使用,不用上网检索就能查找软件信息。
更新 yum -y update,然后yum makecache生成缓存。
2.添加用户并赋予sudo权限
adduser <username>
passwd <username>
whereis sudoers
ls -l /etc/sudoers
chmod -v u+w /etc/sudoers
vim /etc/sudoers
添加一行 <username> ALL=(ALL) ALL
ls -l /etc/sudoers
chmod -v u-w /etc/sudoers
ls -l /etc/sudoers
3.禁止root远程ssh登录
sudo vim /etc/ssh/sshd_config
修改 PermitRootLogin 为 no
重启ssh服务
sudo service sshd restart