yum服务器配置

Posted by wukaiqiang; tagged with linux , yum

一、前期准备
准备两台Linux服务器,本文所用的服务器为CentOS6.9,及CentOS7.4服务器各一台,将另外一台进行访问两台的服务

二、开启CentOS7自动挂载光盘服务
安装autofs包

yum -y install autofs
1
开启自动挂载

systemctl start autofs
1
开机默认开启自动挂载

systemctl enable autofs
1
三、关闭防火墙
centos7

systemctl stop firewalld
关闭
systemctl disable firewalld
开机不启动
1
2
3
4
centos6

service iptables stop
关闭
chkconfig iptables off
开机不启动
1
2
3
4
四、安装HTTP服务

yum install httpd
Complete!.....完成
1
2
启动httpd服务

service httpd start
1
也可以查看进程是否启动没?

ps -aux |grep httpd
root 6500 0.1 0.5 230408 5244 ? Ss 05:36 0:00 /usr/sbin/httpd -DFOREGROUND
apache 6501 0.0 0.3 230544 3768 ? S 05:36 0:00 /usr/sbin/httpd -DFOREGROUND
apache 6502 0.0 0.3 230544 3772 ? S 05:36 0:00 /usr/sbin/httpd -DFOREGROUND
apache 6503 0.0 0.3 230544 3516 ? S 05:36 0:00 /usr/sbin/httpd -DFOREGROUND
apache 6504 0.0 0.3 230544 3516 ? S 05:36 0:00 /usr/sbin/httpd -DFOREGROUND
apache 6511 0.0 0.3 230544 3732 ? S 05:36 0:00 /usr/sbin/httpd -DFOREGROUND
apache 6512 0.0 0.3 230408 3256 ? S 05:36 0:00 /usr/sbin/httpd -DFOREGROUND
apache 6513 0.0 0.3 230408 3020 ? S 05:36 0:00 /usr/sbin/httpd -DFOREGROUND
apache 6514 0.0 0.2 230408 3016 ? S 05:36 0:00 /usr/sbin/httpd -DFOREGROUND
apache 6515 0.0 0.3 230408 3020 ? S 05:36 0:00 /usr/sbin/httpd -DFOREGROUND
apache 6516 0.0 0.3 230408 3020 ? S 05:36 0:00 /usr/sbin/httpd -DFOREGROUND
root 6535 0.0 0.0 112708 980 pts/0 S+ 05:40 0:00 grep --color=auto httpd
1
2
3
4
5
6
7
8
9
10
11
12
13
在浏览器访问网页是否访问
五、创建网页目录
打开httpd包的文件列表,我们看到/var/www/html的文件夹,这里就是存放网页内容的目录了

查看httpd包的文件列表

rpm -ql httpd
1
进入html目录

cd /var/www/html
创建挂载6,7yum源目录
mkdir -pv centos/{6,7}/os/x86_64/
1
2
3
六、创建挂载目录

centos7挂载光驱
[root@JiangXiaoNIU /var/www/html]--mount /dev/sr1 /var/www/html/centos/7/os/x86_64/
mount: /dev/sr1 is write-protected, mounting read-only
centos7挂载6光驱
[root@JiangXiaoNIU /var/www/html]--mount /dev/sr0 /var/www/html/centos/6/os/x86_64/
mount: /dev/sr0 is write-protected, mounting read-only
1
2
3
4
5
6
此时,在浏览器输入:ip/centos/{6,7}/os/x86_64/ 就能看到我们挂载的yum源了

七、配置yum仓库

示例:/etc/yum.repos.d/ 文件里面修改base.repo参数
[test] 仓库名
name=test 描述名,不设置不影响包的安装,但会报错
baseurl=http://172.0.0.1/centos/ $releasever(版本)/os/ $basearch (内型) 设置仓库地址链接
gpgcheck=0 默认为1,表示数字密钥安全检查,0表示不进行安全检查
enabled=0 禁用仓库

vim base.repo

[base]
name=jiangxiaoxiao
baseurl=http://172.0.0.1/centos/$releasever/os/$basearch/
gpgcheck=0
enabled=1
1
2
3
4
5
6
八、更新yum仓库
yum clean all 清空全部yum缓存
yum repolist 显示yum仓库列表
————————————————
版权声明:本文为CSDN博主「姜小小小」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/weixin_44481286/article/details/89564648