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