基礎服務安裝
-
- 一、上傳鏡像
- 二、關閉防火牆與安全政策
- 三、配置主機映射
- 四、配置yum源
- 五、安裝ntp(時間同步)服務
- 六、安裝Openstack軟體包
- 七、 安裝資料庫
- 八、安裝并配置消息伺服器和Memcached
- 九、安裝Memcached
一、上傳鏡像
Controller節點
輕按兩下 SecureFX 将Centos7鏡像與openstack-M版鏡像上次至root目錄

~表示為root目錄,上傳鏡像的位置是自己選擇的
# mkdir -p /opt/centos /opt/mitaka
(建立centos、mitaka目錄)
# mount -o loop CentOS-7-x86_64-DVD-1511.iso /mnt/
(将centos鏡像檔案挂載到mnt目錄下)
# cp -rvf /mnt/* /opt/centos/
(将mnt目錄下挂載的内容拷貝至/opt/centos目錄)
# umount /mnt/
(拷貝完成後取消挂載)
# mount -o loop Mitaka.iso /mnt/
(将openstack鏡像檔案挂載到mnt目錄下)
# cp -rvf /mnt/* /opt/mitaka/
# umount /mnt/
(拷貝完成後取消挂載,mnt目錄下的檔案将會消失)
注:挂載成功後,對應目錄下應該有檔案。
這樣關閉虛拟機後不用重新挂載,可以繼續使用yum源;
也可以在mnt目錄下建立centos和mitaka目錄,将兩個鏡像分别挂載在對應的mnt目錄下,不過每次重新開機虛拟機後需要重新使用mount指令挂載
二、關閉防火牆與安全政策
Controller 和 Compute節點
1)關閉防火牆
# systemctl mask firewalld.service
登出防火牆服務
# systemctl stop firewalld.service
暫停防火牆服務
# systemctl disable firewalld.service
關閉防火牆開機自啟
2)清除iptables安全規則(伺服器慎用)
# iptables -F
# iptables -X
# iptables -Z
# iptables-save
Generated by iptables-save v1.4.21 on Sun Sep 30 16:33:19 2018
*filter
:INPUT ACCEPT [18:1188]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [10:936]
COMMIT
Completed on Sun Sep 30 16:33:19 2018
3)關閉Selinux
# vi /etc/selinux/config
修改 SELINUX=permissive
# setenforce 0 臨時關閉Selinux
三、配置主機映射
Controller 和 Compute節點
# vi /etc/hosts 在hosts檔案中添加如下内容
192.168.100.10 controller
192.168.100.20 compute
修改完成後兩台虛拟機互ping主機名,例如 compute節點 ping controller
能ping通說明配置正确
四、配置yum源
Controller節點
1)配置controller節點的yum源
注: baseurl=file://+centos檔案的路徑 /opt/centos
baseurl=file://+Openstack-Mitaka檔案的路徑/opt/mitaka/Openstack-Mitaka
# mkdir /opt/repo
# mv /etc/yum.repos.d/*.repo /opt/repo/ (離線安裝,是以yum.repos.d目錄下隻能有你自己配置的repo檔案)
[root@controller yum.repos.d]# vi /etc/yum.repos.d/local.repo
[centos]
name=centos
baseurl=file:///opt/centos
gpgcheck=0
enabled=1
[mitaka]
name=mitaka
baseurl=file:///opt/mitaka/Openstack-Mitaka
gpgcheck=0
enabled=1
# yum clean all (清理yum緩存)
# yum list
(列出yum源,檢驗yum是否配置成功)
如圖,yum源配置成功
2)Controller節點安裝FTP服務
# yum install -y vsftpd
# vi /etc/vsftpd/vsftpd.conf
(在vsftpd.conf内添加)
anon_root=/opt (/opt為centos、mitaka檔案的路徑)
# systemctl start vsftpd.service (啟動vsftpd服務)
# systemctl enable vsftpd.service (設定vsftpd服務開機自啟)
Compute節點
3)Compute配置yum源
# mkdir /opt/repo
# mv /etc/yum.repos.d/*.repo /opt/repo/
(離線安裝,是以yum.repos.d目錄下隻能有你自己配置的repo檔案)
# vi /etc/yum.repos.d/local.repo
[centos]
name=centos
baseurl=ftp://192.168.100.10/centos
gpgcheck=0
enabled=1
[mitaka]
name=mitaka
baseurl=ftp://192.168.100.10/mitaka/Openstack-Mitaka
gpgcheck=0
enabled=1
# yum clean all
# yum list (檢驗yum是否配置成功)
五、安裝ntp(時間同步)服務
Controller
# yum install -y ntp
配置ntp.conf檔案
[root@controller ~]# vi /etc/ntp.conf (server下添加)
server 127.127.1.0
fudge 127.127.1.0 stratum 10
# systemctl start ntpd.service
# systemctl enable ntpd.service
# ntpstat (檢視ntp服務狀态)
Compute節點
# yum install -y ntp
# ntpdate controller
如圖,表示ntp服務安裝成功
29 Sep 16:47:08 ntpdate[21333]: the NTP socket is in use, exiting
沒有數字顯示表示ntp服務安裝失敗
六、安裝Openstack軟體包
Controller和Compute節點
# yum install -y python-openstackclient openstack-selinux
# yum –y upgrade --skip-broken
注:安裝完成後可以重新開機兩台虛拟機,使linux更新的核心生效
七、 安裝資料庫
Controller節點
[[email protected] ~]# yum install -y mariadb mariadb-server python2-PyMySQL
配置資料庫
編輯/etc/my.cnf檔案,在[mysqld]下添加如下内容
[mysqld]
bind-address=192.168.100.10 (controller節點的内網IP位址)
default-storage-engine=innodb
innodb_file_per_table
max_connection=4096 (最大連接配接時間4096s)
collation-server=utf8_general_ci
character-set-server=utf8 (使用UTF-8字元集)
# systemctl start mariadb.service
# systemctl enable mariadb.service
# mysql_secure_installation (初始化資料庫并設定密碼)
設定資料庫密碼
預設情況下,MariaDB安裝有一個匿名使用者,允許任何人使用
要登入MariaDB,無需建立使用者帳戶
删除匿名使用者? yes (提高資料安全性)
通常,root使用者隻能從“localhost”連接配接。
這確定某人無法從網絡猜測根密碼。
遠端禁止root使用者登入? no
預設情況下,MariaDB附帶一個名為“test”的資料庫,任何人都可以使用通路。
這也隻是為了測試,應該删除在進入生産環境之前。
删除測試資料庫并通路它? yes
重新加載特權表将確定到目前為止所做的所有更改将立即生效。
現在重新加載權限表? yes
八、安裝并配置消息伺服器和Memcached
Controller節點
# yum install -y rabbitmq-server
# systemctl start rabbitmq-server.service
# systemctl enable rabbitmq-server.service
建立rabbitmq使用者并設定權限
建立使用者:openstack;密碼:123456
# rabbitmqctl add_user openstack 123456
給openstack使用者授予讀/寫通路權限
# rabbitmqctl set_permissions openstack ".*" ".*" ".*"
九、安裝Memcached
# yum install -y memcached python-memcached
# systemctl enable memcached.service
# systemctl start memcached.service