使用devstack 一键安装 openstack详细过程和遇到的坑(Using devstack to install openstack with one click, the detailed process and the pits encountered)

安装参考链接 https://www.cnblogs.com/dyd168/p/14482507.html

后面都是解决坑。。。。

安装之前以下操作是必要的:

[root@jay-server ~]# vim /etc/selinux/config
[root@jay-server ~]# setenforce 0
[root@jay-server ~]# cat /etc/selinux/config 

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these three values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected. 
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

注意点:遇到安装错误,重装需执行 ./clean.sh ==》 /unstack.sh ==》 ./stack.sh

坑一:

ERROR /opt/stack/devstack/lib/neutron_plugins/ovn_agent:174 Socket

As said above by Sage Ren, When we are going to run Command first time and the above error is encounters.

$ ./stack.sh

This error is solved easily by following below steps.

  • Go to neutron_plugin folder, by default the folder is reside in the /opt/stack/devstack/lib/neutron_plugins directory.
  • open ovn_agent file with sudo privileges.
  • change line 116 which looks like this OVS_RUNDIR=$OVS_PREFIX/var/run/openvswitch you just have to change ovn by replacing of openvswitch. after change your line will become OVS_RUNDIR=$OVS_PREFIX/var/run/ovn now save the file.
  • Now go to /var/run/ovn/ directory, In this you will find ovn folder over there. Just remove the folder using $sudo rm -rf ovn command
  • Now first run ./clean.sh and then ./unstack.sh command
  • reboot the system
  • run ./stack.sh

坑二:(这个我没遇到,来自网上)

==========================
[Call Trace]
./stack.sh:499:check_path_perm_sanity
/opt/stack/devstack/functions:612:die
[ERROR] /opt/stack/devstack/functions:612 Invalid path permissions
==========================
fixed:
$ sudo chmod 755 /opt/stack
==========================

坑三:python3.6 安装不了 futures-3.0.5

ERROR: Cannot install nova because these package versions have conflicting dependencies.

The conflict is caused by:
    pypowervm 1.1.26 depends on futures>=3.0; python_version == “3.6”
    The user requested (constraint) futures===3.0.5

To fix this you could try to:
1. loosen the range of package versions you’ve specified
2. remove package versions to allow pip attempt to solve the dependency conflict

ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/user_guide/#fixing-conflicting-dependencies
fixed:
$ wget https://files.pythonhosted.org/packages/55/db/97c1ca37edab586a1ae03d6892b6633d8eaa23b23ac40c7e5bbc55423c78/futures-3.0.5.tar.gz#sha256=0542525145d5afc984c88f914a0c85c77527f65946617edb5274f72406f981df

$ tar xfvz futures-3.0.5.tar.gz

$ cd futures-3.0.5/

$ sed -i ‘s/raise type(self._exception), self._exception, self._traceback/raise Exeption(type(self._exception), self._exception, self._traceback)/’ concurrent/futures/_base.py

$ sudo python3 setup.py install

坑四:(这个我没遇到,来自网上)

+./stack.sh:main:1102 create_keystone_accounts
+lib/keystone:create_keystone_accounts:314 local admin_project
++lib/keystone:create_keystone_accounts:315 oscwrap project show admin -f value -c id
++functions-common:oscwrap:2330 local xtrace
+++functions-common:oscwrap:2331 grep xtrace
+++functions-common:oscwrap:2331 set +o
++functions-common:oscwrap:2331 xtrace=’set -o xtrace’
++functions-common:oscwrap:2332 set +o xtrace
/opt/stack/devstack/functions-common: line 2342: openstack: command not found
++functions-common:oscwrap:2349 return 127
+lib/keystone:create_keystone_accounts:315 admin_project=
+lib/keystone:create_keystone_accounts:1 exit_trap
+./stack.sh:exit_trap:507 local r=127
++./stack.sh:exit_trap:508 jobs -p
+./stack.sh:exit_trap:508 jobs=99848
+./stack.sh:exit_trap:511 [[ -n 99848 ]]
+./stack.sh:exit_trap:511 [[ -n ” ]]
+./stack.sh:exit_trap:517 ‘[‘ -f /tmp/tmp.6eYDz6mXg1 ‘]’
+./stack.sh:exit_trap:518 rm /tmp/tmp.6eYDz6mXg1
+./stack.sh:exit_trap:522 kill_spinner
+./stack.sh:kill_spinner:417 ‘[‘ ‘!’ -z ” ‘]’
+./stack.sh:exit_trap:524 [[ 127 -ne 0 ]]
+./stack.sh:exit_trap:525 echo ‘Error on exit’
Error on exit
+./stack.sh:exit_trap:527 type -p generate-subunit
+./stack.sh:exit_trap:530 [[ -z /opt/stack/logs ]]
+./stack.sh:exit_trap:533 /bin/python3.6 /opt/stack/devstack/tools/worlddump.py -d /opt/stack/logs
==========================
fixed:
$ id
uid=1000(stack) gid=1000(stack) groups=1000(stack),1002(libvirtd)

$ echo “PATH=/usr/local/bin/:\$PATH” >> /opt/stack/.bashrc
$ echo “export PATH” >> /opt/stack/.bashrc

logout and login

坑五:这个其实是因为上次执行报错,没有执行clean.sh

+lib/neutron_plugins/ovn_agent:install_ovn:357 sudo mkdir -p /var/run/openvswitch
++lib/neutron_plugins/ovn_agent:install_ovn:358 whoami
+lib/neutron_plugins/ovn_agent:install_ovn:358 sudo chown stack /var/run/openvswitch
+lib/neutron_plugins/ovn_agent:install_ovn:362 sudo ln -s /var/run/openvswitch /var/run/ovn
ln: failed to create symbolic link ‘/var/run/ovn/openvswitch’: File exists
+lib/neutron_plugins/ovn_agent:install_ovn:1 exit_trap
==========================
fixed:
$ vim /opt/stack/devstack/lib/neutron_plugins/ovn_agent
– sudo ln -s $OVS_RUNDIR $OVN_RUNDIR
+ [ -f $OVN_RUNDIR ] || sudo ln -s $OVS_RUNDIR $OVN_RUNDIR

坑六:按教程安装完之后,重启电脑服务没起来

开放80 6640 9696端口  

 1 [root@jay-server ~]# cat /etc/sysconfig/iptables
 2 # sample configuration for iptables service
 3 # you can edit this manually or use system-config-firewall
 4 # please do not ask us to add additional ports/services to this default configuration
 5 *filter
 6 :INPUT ACCEPT [0:0]
 7 :FORWARD ACCEPT [0:0]
 8 :OUTPUT ACCEPT [0:0]
 9 -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
10 -A INPUT -p icmp -j ACCEPT
11 -A INPUT -i lo -j ACCEPT
12 -A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
13 -A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
14 -A INPUT -p tcp -m state --state NEW -m tcp --dport 6640 -j ACCEPT
15 -A INPUT -p tcp -m state --state NEW -m tcp --dport 9696 -j ACCEPT
16 -A INPUT -j REJECT --reject-with icmp-host-prohibited
17 -A FORWARD -j REJECT --reject-with icmp-host-prohibited
18 COMMIT

 开启启动以下服务:

systemctl ebable httpd
systemctl enable memcached
————————

Installation reference link https://www.cnblogs.com/dyd168/p/14482507.html

There are settlement pits in the back….

The following operations are necessary before installation:

[root@jay-server ~]# vim /etc/selinux/config
[root@jay-server ~]# setenforce 0
[root@jay-server ~]# cat /etc/selinux/config 

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these three values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected. 
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

< strong > note < / strong >: in case of installation error, the reinstallation needs to be performed  ./ clean.sh ==》  / unstack.sh ==》  ./ stack.sh

Pit I:

ERROR /opt/stack/devstack/lib/neutron_plugins/ovn_agent:174 Socket

As said above by Sage Ren, When we are going to run Command first time and the above error is encounters.

$ ./stack.sh

This error is solved easily by following below steps.

  • Go to neutron_plugin folder, by default the folder is reside in the /opt/stack/devstack/lib/neutron_plugins directory.
  • open ovn_agent file with sudo privileges.
  • change line 116 which looks like this OVS_RUNDIR=$OVS_PREFIX/var/run/openvswitch you just have to change ovn by replacing of openvswitch. after change your line will become OVS_RUNDIR=$OVS_PREFIX/var/run/ovn now save the file.
  • Now go to /var/run/ovn/ directory, In this you will find ovn folder over there. Just remove the folder using $sudo rm -rf ovn command
  • Now first run ./clean.sh and then ./unstack.sh command
  • reboot the system
  • run ./stack.sh

Keng 2: (I haven’t met this one, from the Internet)

==========================
[Call Trace]
./stack.sh:499:check_path_perm_sanity
/opt/stack/devstack/functions:612:die
[ERROR] /opt/stack/devstack/functions:612 Invalid path permissions
==========================
fixed:
$ sudo chmod 755 /opt/stack
==========================

坑三:python3.6 安装不了 futures-3.0.5

ERROR: Cannot install nova because these package versions have conflicting dependencies.

The conflict is caused by:
    pypowervm 1.1.26 depends on futures>=3.0; python_version == “3.6”
    The user requested (constraint) futures===3.0.5

To fix this you could try to:
1. loosen the range of package versions you’ve specified
2. remove package versions to allow pip attempt to solve the dependency conflict

ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/user_guide/#fixing-conflicting-dependencies
fixed:
$ wget https://files.pythonhosted.org/packages/55/db/97c1ca37edab586a1ae03d6892b6633d8eaa23b23ac40c7e5bbc55423c78/futures-3.0.5.tar.gz#sha256=0542525145d5afc984c88f914a0c85c77527f65946617edb5274f72406f981df

$ tar xfvz futures-3.0.5.tar.gz

$ cd futures-3.0.5/

$ sed -i ‘s/raise type(self._exception), self._exception, self._traceback/raise Exeption(type(self._exception), self._exception, self._traceback)/’ concurrent/futures/_base.py

$ sudo python3 setup.py install

Keng Si: (I haven’t met this one, from the Internet)

+./stack.sh:main:1102 create_keystone_accounts
+lib/keystone:create_keystone_accounts:314 local admin_project
++lib/keystone:create_keystone_accounts:315 oscwrap project show admin -f value -c id
++functions-common:oscwrap:2330 local xtrace
+++functions-common:oscwrap:2331 grep xtrace
+++functions-common:oscwrap:2331 set +o
++functions-common:oscwrap:2331 xtrace=’set -o xtrace’
++functions-common:oscwrap:2332 set +o xtrace
/opt/stack/devstack/functions-common: line 2342: openstack: command not found
++functions-common:oscwrap:2349 return 127
+lib/keystone:create_keystone_accounts:315 admin_project=
+lib/keystone:create_keystone_accounts:1 exit_trap
+./stack.sh:exit_trap:507 local r=127
++./stack.sh:exit_trap:508 jobs -p
+./stack.sh:exit_trap:508 jobs=99848
+./stack.sh:exit_trap:511 [[ -n 99848 ]]
+./stack.sh:exit_trap:511 [[ -n ” ]]
+./stack.sh:exit_trap:517 ‘[‘ -f /tmp/tmp.6eYDz6mXg1 ‘]’
+./stack.sh:exit_trap:518 rm /tmp/tmp.6eYDz6mXg1
+./stack.sh:exit_trap:522 kill_spinner
+./stack.sh:kill_spinner:417 ‘[‘ ‘!’ -z ” ‘]’
+./stack.sh:exit_trap:524 [[ 127 -ne 0 ]]
+./stack.sh:exit_trap:525 echo ‘Error on exit’
Error on exit
+./stack.sh:exit_trap:527 type -p generate-subunit
+./stack.sh:exit_trap:530 [[ -z /opt/stack/logs ]]
+./stack.sh:exit_trap:533 /bin/python3.6 /opt/stack/devstack/tools/worlddump.py -d /opt/stack/logs
==========================
fixed:
$ id
uid=1000(stack) gid=1000(stack) groups=1000(stack),1002(libvirtd)

$ echo “PATH=/usr/local/bin/:\$PATH” >> /opt/stack/.bashrc
$ echo “export PATH” >> /opt/stack/.bashrc

logout and login

Keng5: This is actually because an error was reported in the last execution, and clean.sh was not executed

+lib/neutron_plugins/ovn_agent:install_ovn:357 sudo mkdir -p /var/run/openvswitch
++lib/neutron_plugins/ovn_agent:install_ovn:358 whoami
+lib/neutron_plugins/ovn_agent:install_ovn:358 sudo chown stack /var/run/openvswitch
+lib/neutron_plugins/ovn_agent:install_ovn:362 sudo ln -s /var/run/openvswitch /var/run/ovn
ln: failed to create symbolic link ‘/var/run/ovn/openvswitch’: File exists
+lib/neutron_plugins/ovn_agent:install_ovn:1 exit_trap
==========================
fixed:
$ vim /opt/stack/devstack/lib/neutron_plugins/ovn_agent
– sudo ln -s $OVS_RUNDIR $OVN_RUNDIR
+ [ -f $OVN_RUNDIR ] || sudo ln -s $OVS_RUNDIR $OVN_RUNDIR

Pit 6: after installing according to the tutorial, restart the computer service does not work

Open port 80 6640 9696

 1 [root@jay-server ~]# cat /etc/sysconfig/iptables
 2 # sample configuration for iptables service
 3 # you can edit this manually or use system-config-firewall
 4 # please do not ask us to add additional ports/services to this default configuration
 5 *filter
 6 :INPUT ACCEPT [0:0]
 7 :FORWARD ACCEPT [0:0]
 8 :OUTPUT ACCEPT [0:0]
 9 -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
10 -A INPUT -p icmp -j ACCEPT
11 -A INPUT -i lo -j ACCEPT
12 -A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
13 -A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
14 -A INPUT -p tcp -m state --state NEW -m tcp --dport 6640 -j ACCEPT
15 -A INPUT -p tcp -m state --state NEW -m tcp --dport 9696 -j ACCEPT
16 -A INPUT -j REJECT --reject-with icmp-host-prohibited
17 -A FORWARD -j REJECT --reject-with icmp-host-prohibited
18 COMMIT

Start the following services:

systemctl ebable httpd
systemctl enable memcached