1.备份原先的配置文件
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo_bak
2.替换新配置
vi /etc/yum.repos.d/CentOS-Base.repo
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#
[base]
name=CentOS-6.10 - Base - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.10/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6
#released updates
[updates]
name=CentOS-6.10 - Updates - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.10/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6
#additional packages that may be useful
[extras]
name=CentOS-6.10 - Extras - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.10/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-6.10 - Plus - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.10/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6
#contrib - packages by Centos Users
[contrib]
name=CentOS-6.10 - Contrib - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.10/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6
3.执行生成缓存
[root@centos6 yum.repos.d]# yum clean all
Loaded plugins: fastestmirror, refresh-packagekit, security
Cleaning repos: base extras updates
Cleaning up Everything
Cleaning up list of fastest mirrors
[root@centos6 yum.repos.d]# yum makecache
Loaded plugins: fastestmirror, refresh-packagekit, security
Determining fastest mirrors
base | 3.7 kB 00:00
base/group_gz | 242 kB 00:01
base/filelists_db | 6.4 MB 00:34
base/primary_db | 4.7 MB 00:25
base/other_db | 2.8 MB 00:14
extras | 3.4 kB 00:00
extras/filelists_db | 24 kB 00:00
extras/prestodelta | 2.2 kB 00:00
extras/primary_db | 29 kB 00:00
extras/other_db | 14 kB 00:00
updates | 3.4 kB 00:00
updates/filelists_db | 8.4 MB 00:45
updates/prestodelta | 357 kB 00:01
updates/primary_db | 12 MB 01:05
updates/other_db | 479 kB 00:02
Metadata Cache Created
4.安装ftp服务
yum -y install vsftpd
5.启动ftp服务
[root@rac1 ~]# service vsftpd status
vsftpd 已停
[root@rac1 ~]# service vsftpd start
为 vsftpd 启动 vsftpd:[确定]
[root@rac1 ~]# service vsftpd restart
[root@rac1 ~]# service vsftpd status
vsftpd (pid 2157) 正在运行...
[root@rac1 ~]# chkconfig vsftpd on
6.centos6默认root用户不能ftp,修改配置文件允许root访问 (在VI打开的文件里面注释掉root--#root)
vi /etc/vsftpd/user_list
vi /etc/vsftpd/ftpusers
连接报错500 OOPS:cannot change directory:/root
解决办法:
1、 查看 SE Linux 的状态: sestatus -b | grep ftp
2、 在出现的结果中可以看到 ftp_home_dir off
tftpd_disable_trans off
之类。我们现在只要把其中之一设置为on就可以啦。
3、 setsebool -P ftpd_disable_trans on 或者 setsebool -P ftp_home_dir on
4、 重启vsftpd: service vsftpd restart
关闭防火墙
# 启动防火墙
service iptables start
# 停止防火墙
service iptables stop
# 重启防火墙
service iptables restart
# 查看防火墙状态
service iptables status
# 开机自动启动
chkconfig iptables on
# 关闭开机启动
chkconfig iptables off
# 保存
service iptables save
# 重新加载
service iptables reload
# 规则列表
chkconfig --list iptables
centos 卸载vsftpd 删除原有的vsftpd(卸载前先关闭 vsftpd: systemctl stop vsftpd)
[root@localhost ~]# rpm -aq vsftpd
vsftpd-2.0.5-16.el5_5.1 #此处是查找vsftpd的返回结果
[root@localhost ~]# rpm -e vsftpd-2.0.5-16.el5_5.1