CentOS7安裝Openvswitch
安裝
1、安裝依賴包:yum -y install openssl-devel wget kernel-devel
2、安裝開發工具:yum groupinstall "Development Tools"
3、新增使用者:adduser ovswitch,切換使用者並跳轉至使用者資料夾:su - ovswitch //此步驟並不是必須,僅僅為為了有一個使用者資料夾好用來執行後面的命令,可以是用當前的非root 使用者執行下面相關的命令
4、下載原始碼:wget http://openvswitch.org/releases/openvswitch-2.5.1.tar.gz
5、解壓:tar xfz openvswitch-2.5.1.tar.gz
6、建立編譯目錄:mkdir -p ~/rpmbuild/SOURCES
7、從spec檔案中刪除openvswitch-kmod的依賴包,並建立一個新的spec檔案:
sed 's/openvswitch-kmod, //g' openvswitch-2.5.1/rhel/openvswitch.spec > openvswitch-2.5.1/rhel/openvswitch_no_kmod.spec
8、開始編譯:rpmbuild -bb --without=check ~/openvswitch-2.5.1/rhel/openvswitch_no_kmod.spec
可能出現以下錯誤:
error: File /home/ovswitch/rpmbuild/SOURCES/openvswitch-2.5.1.tar.gz: No such file or directory
解決辦法:cp openvswitch-2.5.1.tar.gz rpmbuild/SOURCES
9、退出當前使用者使用root: exit
10、安裝編譯生成的rpm檔案:
yum localinstall /home/ovswitch/rpmbuild/RPMS/x86_64/openvswitch-2.5.1-1.x86_64.rpm
11、啟動服務:systemctl start openvswitch.service
12、檢視服務狀態:systemctl -l status openvswitch.service
可能出現以下錯誤:
openvswitch.service - LSB: Open vSwitch switch
Loaded: loaded (/etc/rc.d/init.d/openvswitch)
Active: activating (start) since 四 2014-12-04 18:35:32 CST; 1min 30s ago
Control: 13694 (openvswitch)
CGroup: /system.slice/openvswitch.service
├─13694 /bin/sh /etc/rc.d/init.d/openvswitch start
├─13696 /bin/sh /usr/share/openvswitch/scripts/ovs-ctl start --system-id=random
├─13697 tee -a /var/log/openvswitch/ovs-ctl.log
├─13723 ovs-vswitchd unix:/var/run/openvswitch/db.sock -vconsole:emer -vsyslog:err -vfile:info --mlockall --no-chdir --log-file=/var/log/openvswitch/ovs-vswitchd.log --pidfile=/var/run/openvswitch/ovs-vswitchd.pid --detach --monitor
├─13724 ovs-vswitchd unix:/var/run/openvswitch/db.sock -vconsole:emer -vsyslog:err -vfile:info --mlockall --no-chdir --log-file=/var/log/openvswitch/ovs-vswitchd.log --pidfile=/var/run/openvswitch/ovs-vswitchd.pid --detach --monitor
└─13725 ovs-vswitchd unix:/var/run/openvswitch/db.sock -vconsole:emer -vsyslog:err -vfile:info --mlockall --no-chdir --log-file=/var/log/openvswitch/ovs-vswitchd.log --pidfile=/var/run/openvswitch/ovs-vswitchd.pid --detach --monitor
12月 04 18:35:33 localhost.localdomain openvswitch[13694]: /etc/openvswitch/conf.db does not exist ... (warning).
12月 04 18:35:33 localhost.localdomain openvswitch[13694]: Creating empty database /etc/openvswitch/conf.db ovsdb-tool: I/O error: /etc/openvswitch/conf.db: failed to lock lockfile (Resource temporarily unavailable)
12月 04 18:35:33 localhost.localdomain openvswitch[13694]: [FAILED]
12月 04 18:35:33 localhost.localdomain openvswitch[13694]: Inserting openvswitch module [ OK ]
解決辦法:
yum install policycoreutils-python.x86_64 0:2.2.5-11.el7
mkdir /etc/openvswitch
semanage fcontext -a -t openvswitch_rw_t "/etc/openvswitch(/.*)?"
restorecon -Rv /etc/openvswitch
再次使用:
systemctl stop openvswitch.service
systemctl start openvswitch.service
再次檢視服務狀態:systemctl -l status openvswitch.service
openvswitch.service - LSB: Open vSwitch switch
Loaded: loaded (/etc/rc.d/init.d/openvswitch)
Active: active (running) since 四 2014-12-04 18:38:52 CST; 6s ago
Process: 13741 ExecStart=/etc/rc.d/init.d/openvswitch start (code=exited, status=0/SUCCESS)
CGroup: /system.slice/openvswitch.service
├─13724 ovs-vswitchd: monitoring pid 13725 (healthy)
├─13725 ovs-vswitchd unix:/var/run/openvswitch/db.sock -vconsole:emer -vsyslog:err -vfile:info --mlockall --no-chdir --log-file=/var/log/openvswitch/ovs-vswitchd.log --pidfile=/var/run/openvswitch/ovs-vswitchd.pid --detach --monitor
├─13764 ovsdb-server: monitoring pid 13765 (healthy)
└─13765 ovsdb-server /etc/openvswitch/conf.db -vconsole:emer -vsyslog:err -vfile:info --remote=punix:/var/run/openvswitch/db.sock --private-key=db:Open_vSwitch,SSL,private_key --certificate=db:Open_vSwitch,SSL,certificate --bootstrap-ca-cert=db:Open_vSwitch,SSL,ca_cert --no-chdir --log-file=/var/log/openvswitch/ovsdb-server.log --pidfile=/var/run/openvswitch/ovsdb-server.pid --detach --monitor
12月 04 18:38:51 localhost.localdomain systemd[1]: Starting LSB: Open vSwitch switch...
12月 04 18:38:51 localhost.localdomain openvswitch[13741]: /etc/openvswitch/conf.db does not exist ... (warning).
12月 04 18:38:51 localhost.localdomain openvswitch[13741]: Creating empty database /etc/openvswitch/conf.db [ OK ]
12月 04 18:38:52 localhost.localdomain openvswitch[13741]: Starting ovsdb-server [ OK ]
12月 04 18:38:52 localhost.localdomain openvswitch[13741]: Configuring Open vSwitch system IDs [ OK ]
12月 04 18:38:52 localhost.localdomain openvswitch[13741]: ovs-vswitchd is already running.
12月 04 18:38:52 localhost.localdomain openvswitch[13741]: Enabling remote OVSDB managers [ OK ]
12月 04 18:38:52 localhost.localdomain systemd[1]: Started LSB: Open vSwitch switch.
12月 04 18:38:52 localhost.localdomain openvswitch[13694]: Starting ovs-vswitchd [ OK ]
12月 04 18:38:52 localhost.localdomain openvswitch[13694]: Enabling remote OVSDB managers [ OK ]
安裝完成。
參考:https://n40lab.wordpress.com/2014/09/04/openvswitch-2-3-0-lts-and-centos-7/
相關文章
- Centos7安裝安裝部署dockerCentOSDocker
- CentOS7安裝php、安裝MySqlCentOSPHPMySql
- centos7 安裝pipCentOS
- CentOS7 安裝 MySQLCentOSMySql
- centos7安裝protobufCentOS
- 4.1 CentOS7安裝CentOS
- CentOS7安裝wpsCentOS
- VirtualBox安裝Centos7CentOS
- CentOS7 安裝NginxCentOSNginx
- centos7 安裝rocketmqCentOSMQ
- CentOS7 安裝 dockerCentOSDocker
- centos7安裝dockerCentOSDocker
- CentOS7 安裝 memcacheCentOS
- CentOS7 安裝 libreofficeCentOS
- centos7 安裝 rcloneCentOS
- centos7安裝nginxCentOSNginx
- centos7安裝mysqlCentOSMySql
- Centos7 安裝 NginxCentOSNginx
- Centos7安裝RabbitMQCentOSMQ
- centos7安裝composerCentOS
- centos7安裝supervisorCentOS
- CentOS7安裝RedisCentOSRedis
- Centos7 安裝ffmpegCentOS
- centos7安裝HadoopCentOSHadoop
- centos7安裝教程詳解 centos7安裝詳細步驟CentOS
- mac virualbox 安裝centos7MacCentOS
- centos7快速安裝dockerCentOSDocker
- CentOS7 安裝配置 GitLabCentOSGitlab
- Centos7上安裝dockerCentOSDocker
- 【CentOS】CentOS7安裝PostgreSQLCentOSSQL
- centos7 docker 安裝教程CentOSDocker
- Centos7快速安裝RocketMQCentOSMQ
- centos7下安裝ffmpegCentOS
- centos7下安裝 dockerCentOSDocker
- CentOS7 下安裝 ElasticsearchCentOSElasticsearch
- centos7安裝elasticsearch:7.9.3CentOSElasticsearch
- centos7 安裝MariaDB 10.6CentOS
- centos7安裝zabbix 5.0CentOS