OpenStack之构建本地yum源


一、Centos光盘中的软件仓库源

1、Epel源

2、OpenStack源---openstack-newton

不同版本openstack yum源

http://vault.centos.org/7.2.1511/cloud/x86_64/

3、搭建yum源的几种常见方法

a、本地(不使用网络服务)

b、基于http的软件仓库

c、基于FTP的软件仓库

#下载newton源

wget -m -c -np -nH --cut-dirs=4 -e robots=off http://vault.centos.org/7.2.1511/cloud/x86_64/openstack-newton/ -P /root/newton

#下载ceph源

 wget -m -c -np -nH --cut-dirs=3 -e robots=off http://mirrors.aliyun.com/ceph/rpm-hammer/el7/ -P /root/ceph

二、搭建FTP的软件仓库

1、硬件配置

内存:2G 

CPU:1*1

硬盘:100G

2、更改主机名称

[root@template ~]# hostname ftp-server

[root@template ~]# sed -i 's#HOSTNAME=template.com#HOSTNAME=ftp-server#g' /etc/sysconfig/network

[root@template ~]# logout
Last login: Wed Aug  9 07:51:28 2017 from 192.168.30.1
[root@ftp-server ~]# 

3、关闭防火墙和selinux

#关闭selinux
[root@template ~]# vi /etc/selinux/config 
SELINUX=disabled

[root@template ~]# setenforce 0

#关闭firewalld
[root@template ~]# systemctl disable firewalld
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
Removed symlink /etc/systemd/system/basic.target.wants/firewalld.service.

[root@template ~]# systemctl stop firewalld

4、安装常用软件

yum install wget net-tools vim lrzsz tree screen lsof tcpdump -y

5、安装ftp

[root@template ~]# yum install vsftpd -y

[root@template ~]# systemctl restart vsftpd

[root@template ~]# systemctl enable vsftpd
Created symlink from /etc/systemd/system/multi-user.target.wants/vsftpd.service to /usr/lib/systemd/system/vsftpd.service.

[root@template ~]# ss -lnt
State      Recv-Q Send-Q                     Local Address:Port                                    Peer Address:Port              
LISTEN     0      128                                    *:22                                                 *:*                  
LISTEN     0      100                            127.0.0.1:25                                                 *:*                  
LISTEN     0      32                                    :::21                                                :::*                  
LISTEN     0      128                                   :::22                                                :::*                  
LISTEN     0      100                                  ::1:25                                                :::*    

#访问FTP地址

#目录

[root@yum-server pub]# pwd
/var/ftp/pub
[root@yum-server pub]# ll
total 72
drwxr-xr-x. 14 root root  4096 Oct  1 09:35 centos
drwxr-xr-x.  8 root root  4096 Oct  1 03:51 ceph
drwxr-xr-x.  3 root root    14 Oct  1 03:35 epel
drwxr-xr-x.  4 root root 45056 Feb 10  2017 newton

7、下载openstack--newton源,保存到newton文件夹

[root@ftp-server ~]# mkdir newton
[root@ftp-server ~]# wget -m -c -np -nH --cut-dirs=4 -e robots=off http://vault.centos.org/7.2.1511/cloud/x86_64/openstack-newton/ -P /root/newton
--2017-08-09 08:09:22--  http://vault.centos.org/7.2.1511/cloud/x86_64/openstack-newton/
Resolving vault.centos.org (vault.centos.org)... 

8、ftp目录

#进入ftp默认目录

[root@yum ~]# cd /var/ftp/pub/

#上传newton源到这个目录下

[root@yum pub]# ll
total 821068
-rw-r--r--. 1 root root 840771712 Sep  7 17:46 openstack-newton.tar.gz

#解压并改文件夹名称

[root@yum pub]# tar -xf openstack-newton.tar.gz 

[root@yum pub]# mv openstack-newton newton

[root@yum pub]# ll
total 821132
drwxr-xr-x. 4 root root     45056 Feb 10  2017 newton
-rw-r--r--. 1 root root 840771712 Sep  7 17:46 openstack-newton.tar.gz

#删除多余文件
[root@yum pub]# rm -rf openstack-newton.tar.gz 

#查看ftp目录

#进入tmp临时目录

#创建空文件夹
[root@yum tmp]# mkdir -p /tmp/yum

[root@yum tmp]# ll
drwxr-xr-x. 2 root root   6 Sep  7 17:59 yum

#把系统yum源移到tmp/yum文件夹中
[root@yum tmp]# mv /etc/yum.repos.d/* /tmp/yum

[root@yum tmp]# cd yum
[root@yum yum]# ll
total 28
-rw-r--r--. 1 root root 1664 Dec  9  2015 CentOS-Base.repo
-rw-r--r--. 1 root root 1309 Dec  9  2015 CentOS-CR.repo
-rw-r--r--. 1 root root  649 Dec  9  2015 CentOS-Debuginfo.repo
-rw-r--r--. 1 root root  290 Dec  9  2015 CentOS-fasttrack.repo
-rw-r--r--. 1 root root  630 Dec  9  2015 CentOS-Media.repo
-rw-r--r--. 1 root root 1331 Dec  9  2015 CentOS-Sources.repo
-rw-r--r--. 1 root root 1952 Dec  9  2015 CentOS-Vault.repo

#创建本地yum源文件

[root@yum-server pub]# cd /var/ftp/pub
[root@yum-server pub]# ll
total 72
drwxr-xr-x. 14 root root  4096 Oct  1 09:35 centos
drwxr-xr-x.  8 root root  4096 Oct  1 03:51 ceph
drwxr-xr-x.  3 root root    14 Oct  1 03:35 epel
drwxr-xr-x.  4 root root 45056 Feb 10  2017 newton

#生成缓存文件

#先安装createrepo工具。

创建repodata文件,这是一个数据包创建索引的过程,所以也有点慢。

mkdir /packages/Packages/

createrepo -p -d -o /centos/os/x86_64/

#openstack yum源全部文件

[root@yum-server yum.repos.d]# vi centos.repo

[centos]
name=centos
baseurl=ftp://yum.kuaiwei.com/pub/centos/os/x86_64/
gpgcheck=0
enabled=1 
[updates]
name=updates
baseurl=ftp://yum.kuaiwei.com/pub/centos/updates/x86_64/
gpgcheck=0
enabled=1 
#additional packages that may be useful
[extras]
name=extras
baseurl=ftp://yum.kuaiwei.com/pub/centos/extras/x86_64/
gpgcheck=0
enabled=1

[root@yum-server yum.repos.d]# vi ceph.repo 

[ceph]
name=ceph
baseurl=ftp://yum.kuaiwei.com/pub/newton/
enbled=1
gpgcheck=0

[root@yum-server yum.repos.d]# vi epel.repo

[epel]
name=epel
baseurl=ftp://yum.kuaiwei.com/pub/epel/7/x86_64
enbled=1
gpgcheck=0

[root@yum-server yum.repos.d]# vi newton.repo

[newton]
name=openstack-newton
baseurl=ftp://yum.kuaiwei.com/pub/newton/
enbled=1
gpgcheck=0

#清空缓存和生成缓存

[root@yum yum.repos.d]# yum clean all
Loaded plugins: fastestmirror
Cleaning repos: newton
Cleaning up everything
Cleaning up list of fastest mirrors

[root@yum yum.repos.d]# yum makecache
Loaded plugins: fastestmirror
newton                                                                                  | 2.9 kB  00:00:00     
(1/3): newton/filelists_db                                                              | 1.8 MB  00:00:00     
(2/3): newton/primary_db                                                                | 671 kB  00:00:00     
(3/3): newton/other_db                                                                  | 304 kB  00:00:00     
Determining fastest mirrors
Metadata Cache Created

[root@yum yum.repos.d]# yum list

#mariadb集成到了newton包中

[root@yum newton]# ls|grep mari
mariadb-10.1.12-4.el7.x86_64.rpm
mariadb-bench-10.1.12-4.el7.x86_64.rpm
mariadb-common-10.1.12-4.el7.x86_64.rpm
mariadb-config-10.1.12-4.el7.x86_64.rpm
mariadb-connect-engine-10.1.12-4.el7.x86_64.rpm
mariadb-devel-10.1.12-4.el7.x86_64.rpm
mariadb-embedded-10.1.12-4.el7.x86_64.rpm
mariadb-embedded-devel-10.1.12-4.el7.x86_64.rpm
mariadb-errmsg-10.1.12-4.el7.x86_64.rpm
mariadb-libs-10.1.12-4.el7.x86_64.rpm
mariadb-server-10.1.12-4.el7.x86_64.rpm
mariadb-server-galera-10.1.12-4.el7.x86_64.rpm
mariadb-test-10.1.12-4.el7.x86_64.rpm

#安装zip and unzip

#依赖gcc
yum install gcc gcc++ -y

#查看是否安装成功
yum list|grep gcc

#安装unzip解压软件
yum install zip unzip -y

#查看是否安装成功
yum list|grep unzip 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM