私有云技术

2020-05-23 16:03:08来源:博客园 阅读 ()

新老客户大回馈,云服务器低至5折

私有云技术

私有云技术

使用脚本部署OpenStack平台

需要两台主机,一台控制节点,一台计算节点

控制节点:安装MySQL、Keystone、Glance、Nova、Neutron、Dashboard等服务,主要作为认证、镜像管理节点,以及提供Nova和Neutron服务的管理节点。提供Dashboard界面服务

计算节点:安装nova-compute和Neutron服务,Nova服务提供云主机服务,Neutron提供网络服务

基础环境配置

基础配置

两个节点设置第一张网卡为仅主机模式,第二张网卡为NAT模式,以及配置CPU虚拟化

 

 

计算节点至少使用4 GB内存,硬盘不小于50 GB

IP地址配置

控制节点ip配置

# hostnamectl set-hostname controller

# vi /etc/sysconfig/network-scripts/ifcfg-eno16777736
TYPE=Ethernet
BOOTPROTO=static
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
NAME=eno16777736
UUID=8c4cfa11-e842-4d06-9320-0cf31d42075c
DEVICE=eno16777736
ONBOOT=yes
IPADDR=192.168.10.10
NETMASK=255.255.255.0
GATEWAY=192.168.10.2

# vi /etc/sysconfig/network-scripts/ifcfg-eno33554960
TYPE=Ethernet
BOOTPROTO=static
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
NAME=eno33554960
UUID=69fd9c09-d0ec-496d-a0da-c7fc077b0e7a
DEVICE=eno33554960
ONBOOT=yes
IPADDR=192.168.20.10
NETMASK=255.255.255.0
GATEWAY=192.168.20.2

计算节点ip配置

# hostnamectl set-hostname compute

 

# vi /etc/sysconfig/network-scripts/ifcfg-eno16777736
TYPE=Ethernet
BOOTPROTO=static
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
NAME=eno16777736
UUID=604a502b-fe44-4284-8361-27ca70ed1a89
DEVICE=eno16777736
ONBOOT=yes
IPADDR=192.168.10.20
NETMASK=255.255.255.0
GATEWAY=192.168.10.2

# vi /etc/sysconfig/network-scripts/ifcfg-eno33554960
TYPE=Ethernet
BOOTPROTO=static
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
NAME=eno33554960
UUID=9323fac9-2c37-4604-9dc9-777cbeefdcd6
DEVICE=eno33554960
ONBOOT=yes
IPADDR=192.168.20.20
NETMASK=255.255.255.0
GATEWAY=192.168.20.2

上传基础镜像(控制节点)

XianDian-IaaS-v2.2.iso和CentOS-7-x86_64-DVD-1511.iso两个镜像包上传至controller节点的/root目录中

# ll
总用量 7012772
-rw-------. 1 root root       1635 5月  19 02:52 anaconda-ks.cfg
-rw-r--r--. 1 root root 4329570304 5月  20 17:11 CentOS-7-x86_64-DVD-1511.iso
-rw-r--r--. 1 root root 2851502080 11月  6 2017 XianDian-IaaS-v2.2.iso

将镜像文件挂载到/opt目录

# mkdir /opt/centos7.2

# mkdir /opt/iaas

# mount /root/CentOS-7-x86_64-DVD-1511.iso /opt/centos7.2/
mount: /dev/loop0 写保护,将以只读方式挂载

# mount /root/XianDian-IaaS-v2.2.iso /opt/iaas/
mount: /dev/loop1 写保护,将以只读方式挂载

配置YUM源文件

controller节点

# rm -rf /etc/yum.repos.d/CentOS-*

# vi /etc/yum.repos.d/local.repo 
[centos]
name=centos
baseurl=file:///opt/centos7.2
gpgcheck=0
enabled=1
[iaas]
name=iaas
baseurl=file:///opt/iaas/iaas-repo
gpgcheck=0
enabled=1

compute节点

# rm -rf /etc/yum.repos.d/CentOS-*

# vi /etc/yum.repos.d/local.repo 
[centos]
name=centos
baseurl=ftp://192.168.10.10/centos7.2
gpgcheck=0
enabled=1
[iaas]
name=iaas
baseurl=ftp://192.168.10.10/iaas/iaas-repo
gpgcheck=0
enabled=1

安装ftp服务(控制节点)

# yum install -y vsftpd

编辑配置文件

# vi /etc/vsftpd/vsftpd.conf

文件最上边添加代码

anon_root=/opt

重启服务

# systemctl restart vsftpd

配置防火墙策略(两个节点)

# setenforce 0

# iptables -F

# iptables -X

# iptables -Z

# systemctl stop firewalld

安装服务(两个节点)

安装iaas-xiandian软件包

# yum install -y iaas-xiandian

配置环境变量(两个节点)

# vi /etc/xiandian/openrc.sh

HOST_IP=192.168.10.10
HOST_NAME=controller
HOST_IP_NODE=192.168.10.20
HOST_NAME_NODE=compute
RABBIT_USER=openstack
RABBIT_PASS=000000
DB_PASS=000000
DOMAIN_NAME=demo
ADMIN_PASS=000000
DEMO_PASS=000000
KEYSTONE_DBPASS=000000
GLANCE_DBPASS=000000
GLANCE_PASS=000000
NOVA_DBPASS=000000
NOVA_PASS=000000
NEUTRON_DBPASS=000000
NEUTRON_PASS=000000
METADATA_SECRET=000000
INTERFACE_NAME=eno33554960
CINDER_DBPASS=000000
CINDER_PASS=000000
BLOCK_DISK=md126p3
TROVE_DBPASS=000000
TROVE_PASS=000000
SWIFT_PASS=000000
OBJECT_DISK=md126p4
STORAGE_LOCAL_NET_IP=192.168.10.20
HEAT_DBPASS=000000
HEAT_PASS=000000
CEILOMETER_DBPASS=000000
CEILOMETER_PASS=000000
AODH_DBPASS=000000
AODH_PASS=000000 

使用脚本安装OpenStack平台

安装基础服务(两个节点)

通过脚本安装基础服务

# iaas-pre-host.sh

安装完成后,退出并重新登陆,使主机名生效

安装MYSQL数据库服务(控制节点)

通过脚本安装MYSQL数据库服务

# iaas-install-mysql.sh

安装Keystone认证服务(控制节点)

通过脚本安装Keystone认证服务

# iaas-install-keystone.sh

安装Glance镜像服务(控制节点)

通过脚本安装Glance镜像服务

# iaas-install-glance.sh

安装Nova计算服务

控制节点通过脚本安装计算服务

# iaas-install-nova-controller.sh

计算节点通过脚本安装计算服务

# iaas-install-nova-compute.sh

安装Neutron网络服务

控制节点通过脚本安装网络服务

# iaas-install-neutron-controller.sh

# iaas-install-neutron-controller-gre.sh

计算节点通过脚本安装网络服务

# iaas-install-neutron-compute.sh

# iaas-install-neutron-compute-gre.sh

安装Dashboard服务(控制节点)

通过脚本安装Dashboard服务

# iaas-install-dashboard.sh

安装Cinder块存储服务

控制节点通过脚本安装块存储服务

# iaas-install-cinder-controller.sh

计算节点通过脚本安装块存储服务

# iaas-install-cinder-compute.sh

安装Swift对象存储服务

控制节点通过脚本安装对象存储服务

# iaas-install-swift-controller.sh

计算通过脚本安装对象存储服务

# iaas-install-swift-compute.sh

访问Dashboard服务

打开浏览器,访问92.168.10.10/dashboard

 

 登录后即可访问到Dashboard系统

OpenStack平台使用 

创建镜像

复制镜像到控制节点(控制节点)

在控制节点找到qcow2镜像

# cd /opt/iaas/images/

# ls
CentOS_6.5_x86_64_XD.qcow2  CentOS_7.2_x86_64_XD.qcow2  MySQL_5.6_XD.qcow2

上传镜像到Glane服务(控制节点)

将qcow2镜像上传到平台中

# source /etc/keystone/admin-openrc.sh

# glance image-create --name "centos7.2" --disk-format qcow2 --container-format bare --progress < CentOS_7.2_x86_64_XD.qcow2
[=============================>] 100%
+------------------+--------------------------------------+
| Property         | Value                                |
+------------------+--------------------------------------+
| checksum         | ea197f4c679b8e1ce34c0aa70ae2a94a     |
| container_format | bare                                 |
| created_at       | 2020-05-20T19:39:58Z                 |
| disk_format      | qcow2                                |
| id               | 554dedbb-4bc4-4825-ab8a-29385f1b6cfa |
| min_disk         | 0                                    |
| min_ram          | 0                                    |
| name             | centos7.2                            |
| owner            | 07ea51a6ef9a4a3cb9f6930b2db2df7f     |
| protected        | False                                |
| size             | 400752640                            |
| status           | active                               |
| tags             | []                                   |
| updated_at       | 2020-05-20T19:40:10Z                 |
| virtual_size     | None                                 |
| visibility       | private                              |
+------------------+--------------------------------------+

创建外部网络

创建网络

在浏览器选择菜单栏“项目”→“网络”→“网络”命令,单击右侧“创建网络”按钮,创建虚拟机网络

 

设置网络 

在弹出的窗口中,输入网络名称为net-gre,管理状态为up,单击“前进”按钮

 

创建子网 

在弹出的对话框中填写子网信息,单击“前进”按钮

 

设置DHCP地址池 

配置DHCP地址池,勾选“激活DHCP”复选框,添加“114.114.114.114”的NDS服务器,单击“已创建”按钮创建网络

选择外部网络 

选择菜单栏“管理员”→“系统”→“ 网络”命令,在已创建的外部网络中,选择“操作”下拉菜单中“编辑网络”菜单命令

在弹出的对话框中,勾选“外部网络”复选框,单击“保存”按钮

创建内部网络 

创建网络

选择菜单栏“项目”→“网络”→“网络”命令,右侧单击“创建网络”按钮,创建虚拟机网络

 

设置网络

在弹出的对话框中设置网络名称,然后单击“前进”按钮

 

设置子网 

设置子网名称为“int-subnet”,网络地址为“10.10.0.0/24”,网关IP地址为“10.10.0.1”,单击“前进”按钮

 

设置DHCP 

在弹出的对话框中,勾选“激活DHCP”复选框,并点击“已创建”按钮

 

创建路由器 

创建路由

选择菜单栏“项目”→“网络”→“路由”命令,右侧单击“新建路由”按钮,创建路由

 

设置路由 

在弹出的对话框中设置路由名称为“route”,在外部网络下拉菜单中,选择外部网络“net-gre”,单击“新建路由”按钮

 

添加内部网络端口 

单击新创建的路由名称,进入路由编辑页面

 

选择“接口”标签,单击“增加接口”按钮

 

 在弹出的对话框中,选择“int-gre”内部网络,然后单击“提交”按钮

 

管理安全组 

管理default默认安全组

管理访问策略安全组,选择菜单栏“项目”→“计算”→“访问&安全”命令,管理default默认规则

 

添加放行策略 

单击右侧“添加规则”按钮,放行通信策略

 

放行所有ICMP协议,单击“添加”按钮

 

放行所有TCP协议,单击“添加”按钮 

 

放行所有UDP协议,单击“添加”按钮

 

创建云主机 

创建云主机

创建云主机,选择菜单栏“项目”→“计算”→“云主机”命令,单击右侧“创建云主机”按钮

 

设置云主机名称 

在弹出的对话框中,输入创建的云主机名称以及数量,然后单击“下一步”按钮

 

选择云主机镜像 

在“源”中选择所要使用的镜像文件,单击对应镜像后的“+”按钮,然后单击“下一步”按钮

 

选择云主机资源类型 

在“flavor”中选择所需云主机的资源类型,选择“m1.small”资源类型,单击对应的“+”按钮,然后单击“下一步”按钮

 

选择云主机网络 

在“网络”中使云主机使用创建的int-gre内部网络,单击对应的“+”按钮,然后单击“启动实例”按钮

  

绑定浮动ip地址 

选择菜单栏的“项目”→“计算”→“云主机”命令,在“操作”的下拉菜单中选择“绑定浮动IP”菜单命令

 

在弹出的对话框中单击“+”按钮,分配一个IP地址 

 

单击“分配IP”按钮,单击“关联”按钮,关联浮动ip地址

 

查看云主机创建状态 

创建完成后,可以在“云主机”页面中显示云主机列表,可查看到创建的云主机状态为“运行”

 

 

测试云主机连通性

回到电脑,window+R打开CMD窗口,通过ping命令进行测试,可以连通云主机

 

通过secureCRT工具,连接云主机,查看云主机IP地址,用户名为root,密码为00000 

 

 

Keystone服务运维 

OpenStack框架中,Keystone(OpenStack Identity Service)的功能是负责验证身份、校验服务规则和发布服务令牌的,它实现了OpenStack的Identity API。Keystone可分解为两个功能,即权限管理和服务目录。权限管理主要用于用户的管理授权。服务目录,类似一个服务总线,或者说是整个OpenStack框架的注册表。认证模块提供API服务、Token令牌机制、服务目录、规则和认证发布等功能

Keystone运维命令

创建用户(控制节点)

创建用户的具体格式

$ openstack user create [--domain <domain>]

[--password <password>]

[--email <email-address>]

[--enable | --disable]

<name>

创建一个名称为“alice”账户,密码为“mypassword123”,邮箱为“alice@example.com”

# source /etc/keystone/admin-openrc.sh

# openstack user create --password mypassword123 --email alice@example.com --domain demo alice
+-----------+----------------------------------+
| Field     | Value                            |
+-----------+----------------------------------+
| domain_id | 1b3296609d0b4f82a7734e5439033935 |
| email     | alice@example.com                |
| enabled   | True                             |
| id        | fd6877910f884ef3b5b619adab16ada9 |
| name      | alice                            |
+-----------+----------------------------------+

创建项目(控制节点)

一个Project就是一个项目、团队或组织,当请求OpenStack服务时,必须定义一个项目

创建项目的格式

$ openstack project create [--domain <domain>]

                              [--description <description>]

                              [--enable | --disable]

   <project-name>

创建一个名为“acme”的项目

# openstack project create --domain demo acme
+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description |                                  |
| domain_id   | 1b3296609d0b4f82a7734e5439033935 |
| enabled     | True                             |
| id          | 5a1740c1194d425b844f9df90e88d969 |
| is_domain   | False                            |
| name        | acme                             |
| parent_id   | 1b3296609d0b4f82a7734e5439033935 |
+-------------+----------------------------------+

创建角色(控制节点)

角色限定了用户的操作权限

创建角色的具体格式

$ openstack user create <name>

创建一个角色“compute-user

# openstack role create compute-user
+-----------+----------------------------------+
| Field     | Value                            |
+-----------+----------------------------------+
| domain_id | None                             |
| id        | f18f7c0f40a54378aa4c51c3b250e56b |
| name      | compute-user                     |
+-----------+----------------------------------+

绑定用户和项目权限(控制节点)

添加的用户需要分配一定的权限,这就需要把用户关联绑定到对应的项目和角色

绑定用户和项目权限的具体格式

$ openstack role add --user <user> --project <project> <role>

给用户“alice”分配“acme”项目下的“compute-user”角色

# openstack role add --user alice --project acme compute-user

Keystone基础查询命令

用户列表查询(控制节点)

OpenStack平台所使用的用户可以通过Keystone组件进行查询

查询所有用户列表信息

# openstack user list
+----------------------------------+---------+
| ID                               | Name    |
+----------------------------------+---------+
| 5cbf8d5eb0cd48b3b2018a988f52e405 | neutron |
| 6c82348164d646df9b2a94d183a41c3b | cinder  |
| 7d569ea77c8f4e1e96995be7608c713a | demo    |
| a689d312175643819f4f48cf44975cea | nova    |
| b2ea672397fa40849b3b65ae6dd72f6a | admin   |
| ce88d040605541b092c3e18717d08fd4 | swift   |
| e91ee100c089479aa18392c821c52d38 | glance  |
| fd6877910f884ef3b5b619adab16ada9 | alice   |
+----------------------------------+---------+

查询用户详细信息和状态

# openstack user show alice
+-----------+----------------------------------+
| Field     | Value                            |
+-----------+----------------------------------+
| domain_id | 1b3296609d0b4f82a7734e5439033935 |
| email     | alice@example.com                |
| enabled   | True                             |
| id        | fd6877910f884ef3b5b619adab16ada9 |
| name      | alice                            |
+-----------+----------------------------------+

项目列表查询(控制节点)

查询平台中所有存在项目列表

# openstack project list
+----------------------------------+---------+
| ID                               | Name    |
+----------------------------------+---------+
| 5a1740c1194d425b844f9df90e88d969 | acme    |
| 81945ab408cf4c8e86fadc28a83d2d2d | admin   |
| d23d9122a904433b83cabcb96d048614 | service |
| daa94a9af47a4adfbed9a33086874186 | demo    |
+----------------------------------+---------+

查询“acme”项目的详细信息

# openstack project show acme
+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description |                                  |
| domain_id   | 1b3296609d0b4f82a7734e5439033935 |
| enabled     | True                             |
| id          | 5a1740c1194d425b844f9df90e88d969 |
| is_domain   | False                            |
| name        | acme                             |
| parent_id   | 1b3296609d0b4f82a7734e5439033935 |
+-------------+----------------------------------+

角色列表查询(控制节点)

查询角色列表信息

# openstack role list
+----------------------------------+--------------+
| ID                               | Name         |
+----------------------------------+--------------+
| 1b7c050f80854656a5385cfa8a51f26e | admin        |
| 64ed8b55474a49ab90ca2eca5625cbe0 | user         |
| f18f7c0f40a54378aa4c51c3b250e56b | compute-user |
+----------------------------------+--------------+

查询“compute-user”角色的详细信息

# openstack role show compute-user
+-----------+----------------------------------+
| Field     | Value                            |
+-----------+----------------------------------+
| domain_id | None                             |
| id        | f18f7c0f40a54378aa4c51c3b250e56b |
| name      | compute-user                     |
+-----------+----------------------------------+

端点地址查询(控制节点)

Keystone组件管理OpenStack平台中所有服务端点信息,通过命令可以查询平台中所有服务所使用的端点地址信息

# openstack endpoint list
+-----------+-----------+--------------+--------------+---------+-----------+------------+
| ID        | Region    | Service Name | Service Type | Enabled | Interface | URL        |
+-----------+-----------+--------------+--------------+---------+-----------+------------+
| 142d33757 | RegionOne | keystone     | identity     | True    | admin     | http://con |
| dad4a9290 |           |              |              |         |           | troller:35 |
| 16113ef74 |           |              |              |         |           | 357/v3     |
| a742b     |           |              |              |         |           |            |
| 1f0fdb8af | RegionOne | swift        | object-store | True    | internal  | http://con |
| bf94b7abf |           |              |              |         |           | troller:80 |
| 28ac38dff |           |              |              |         |           | 80/v1/AUTH |
| c0f6a     |           |              |              |         |           | _%(tenant_ |
|           |           |              |              |         |           | id)s       |
| 29f944673 | RegionOne | swift        | object-store | True    | public    | http://con |
| ad74b7e9d |           |              |              |         |           | troller:80 |
| aa206a40a |           |              |              |         |           | 80/v1/AUTH |
| 766c8     |           |              |              |         |           | _%(tenant_ |
|           |           |              |              |         |           | id)s       |
| 3700332b3 | RegionOne | keystone     | identity     | True    | public    | http://con |
| a6346618c |           |              |              |         |           | troller:50 |
| 5e062d71f |           |              |              |         |           | 00/v3      |
| 37353     |           |              |              |         |           |            |
| 3cc9a5531 | RegionOne | glance       | image        | True    | public    | http://con |
| ee247318c |           |              |              |         |           | troller:92 |
| 28d35ade6 |           |              |              |         |           | 92         |
| 62744     |           |              |              |         |           |            |
| 45347af92 | RegionOne | cinder       | volume       | True    | internal  | http://con |
| 70d42e6a5 |           |              |              |         |           | troller:87 |
| 08b8bed47 |           |              |              |         |           | 76/v1/%(te |
| bad38     |           |              |              |         |           | nant_id)s  |
| 46cfdc6a4 | RegionOne | cinder       | volume       | True    | public    | http://con |
| 0bf48b4bb |           |              |              |         |           | troller:87 |
| 8a8504d2b |           |              |              |         |           | 76/v1/%(te |
| c24bb     |           |              |              |         |           | nant_id)s  |
| 54acfa284 | RegionOne | nova         | compute      | True    | admin     | http://con |
| f204dc98c |           |              |              |         |           | troller:87 |
| 4aa22de7b |           |              |              |         |           | 74/v2.1/%( |
| 034c1     |           |              |              |         |           | tenant_id) |
|           |           |              |              |         |           | s          |
| 54ca2be22 | RegionOne | glance       | image        | True    | internal  | http://con |
| f60473ab8 |           |              |              |         |           | troller:92 |
| b723935be |           |              |              |         |           | 92         |
| 8d455     |           |              |              |         |           |            |
| 67b8130ad | RegionOne | keystone     | identity     | True    | internal  | http://con |
| 3104b398f |           |              |              |         |           | troller:50 |
| f49cb9fa1 |           |              |              |         |           | 00/v3      |
| edbbf     |           |              |              |         |           |            |
| 71487ce33 | RegionOne | cinderv2     | volumev2     | True    | admin     | http://con |
| d8b4263b5 |           |              |              |         |           | troller:87 |
| d4a450256 |           |              |              |         |           | 76/v2/%(te |
| 1b08f     |           |              |              |         |           | nant_id)s  |
| 7ca7ca1bb | RegionOne | cinder       | volume       | True    | admin     | http://con |
| d0c47e6bb |           |              |              |         |           | troller:87 |
| 8a80b56a4 |           |              |              |         |           | 76/v1/%(te |
| 23d17     |           |              |              |         |           | nant_id)s  |
| 8fbea79b4 | RegionOne | swift        | object-store | True    | admin     | http://con |
| 68c472eaf |           |              |              |         |           | troller:80 |
| 92d100f03 |           |              |              |         |           | 80/v1      |
| 63385     |           |              |              |         |           |            |
| a2e126d9b | RegionOne | nova         | compute      | True    | public    | http://con |
| ea141d689 |           |              |              |         |           | troller:87 |
| 454e3cf74 |           |              |              |         |           | 74/v2.1/%( |
| e2919     |           |              |              |         |           | tenant_id) |
|           |           |              |              |         |           | s          |
| ada04574a | RegionOne | neutron      | network      | True    | admin     | http://con |
| 5e847e7a2 |           |              |              |         |           | troller:96 |
| 7d4e05959 |           |              |              |         |           | 96         |
| bff7d     |           |              |              |         |           |            |
| d696f82bb | RegionOne | neutron      | network      | True    | public    | http://con |
| 4574cedb1 |           |              |              |         |           | troller:96 |
| 9d7dbb9dd |           |              |              |         |           | 96         |
| af7c0     |           |              |              |         |           |            |
| db6d1ece1 | RegionOne | nova         | compute      | True    | internal  | http://con |
| 6074043b1 |           |              |              |         |           | troller:87 |
| 73f64cff2 |           |              |              |         |           | 74/v2.1/%( |
| c9f3f     |           |              |              |         |           | tenant_id) |
|           |           |              |              |         |           | s          |
| dc30fb7cb | RegionOne | cinderv2     | volumev2     | True    | public    | http://con |
| 46b4649be |           |              |              |         |           | troller:87 |
| c721c21f9 |           |              |              |         |           | 76/v2/%(te |
| d52d4     |           |              |              |         |           | nant_id)s  |
| f27638936 | RegionOne | neutron      | network      | True    | internal  | http://con |
| c444e3fb1 |           |              |              |         |           | troller:96 |
| 1c824bc02 |           |              |              |         |           | 96         |
| 9de81     |           |              |              |         |           |            |
| f43aa80bc | RegionOne | cinderv2     | volumev2     | True    | internal  | http://con |
| b2f4db598 |           |              |              |         |           | troller:87 |
| afb9d1026 |           |              |              |         |           | 76/v2/%(te |
| 8874e     |           |              |              |         |           | nant_id)s  |
| f43c02b42 | RegionOne | glance       | image        | True    | admin     | http://con |
| 67c486f85 |           |              |              |         |           | troller:92 |
| e8efc3fd6 |           |              |              |         |           | 92         |
| d8b66     |           |              |              |         |           |            |
+-----------+-----------+--------------+--------------+---------+-----------+------------+

 

Glance服务运维

Glance镜像服务实现发现、注册、获取虚拟机镜像和镜像元数据,镜像数据支持多种存储系统,可以是简单文件系统、对象存储系统等。Glance镜像服务是典型的C/S架构,Glance架构包括glance-CLIent、Glance和Glance Store。Glance主要包括REST API、数据库抽象层(DAL)、域控制器(glance domain controller)和注册层(registry layer),Glance 使用集中数据库(Glance DB)在Glance各组件间直接共享数据

Glance管理镜像

创建镜像(控制节点)

将提供的镜像文件cirros-0.3.4-x86_64-disk.img上传到控制节点的/root目录

创建一个名称为“cirros”的镜像

# glance image-create --name "cirros" --disk-format qcow2 --container-format bare --progress < cirros-0.3.4-x86_64-disk.img
[=============================>] 100%
+------------------+--------------------------------------+
| Property         | Value                                |
+------------------+--------------------------------------+
| checksum         | ee1eca47dc88f4879d8a229cc70a07c6     |
| container_format | bare                                 |
| created_at       | 2020-05-21T22:13:34Z                 |
| disk_format      | qcow2                                |
| id               | d2b3013e-4aac-4e4b-a506-a88de0e6bdad |
| min_disk         | 0                                    |
| min_ram          | 0                                    |
| name             | cirros                               |
| owner            | 81945ab408cf4c8e86fadc28a83d2d2d     |
| protected        | False                                |
| size             | 13287936                             |
| status           | active                               |
| tags             | []                                   |
| updated_at       | 2020-05-21T22:13:35Z                 |
| virtual_size     | None                                 |
| visibility       | private                              |
+------------------+--------------------------------------+

查看镜像列表(控制节点)

查询镜像列表命令及结果

# glance image-list
+--------------------------------------+-----------+
| ID                                   | Name      |
+--------------------------------------+-----------+
| edd13c0b-9711-4ef8-9a27-c565ea511ba3 | centos7.2 |
| d2b3013e-4aac-4e4b-a506-a88de0e6bdad | cirros    |
+--------------------------------------+-----------+

Glance镜像运维

查看镜像详情(控制节点)

查看镜像的详细信息

# glance image-show d2b3013e-4aac-4e4b-a506-a88de0e6bdad
+------------------+--------------------------------------+
| Property         | Value                                |
+------------------+--------------------------------------+
| checksum         | ee1eca47dc88f4879d8a229cc70a07c6     |
| container_format | bare                                 |
| created_at       | 2020-05-21T22:13:34Z                 |
| disk_format      | qcow2                                |
| id               | d2b3013e-4aac-4e4b-a506-a88de0e6bdad |
| min_disk         | 0                                    |
| min_ram          | 0                                    |
| name             | cirros                               |
| owner            | 81945ab408cf4c8e86fadc28a83d2d2d     |
| protected        | False                                |
| size             | 13287936                             |
| status           | active                               |
| tags             | []                                   |
| updated_at       | 2020-05-21T22:13:35Z                 |
| virtual_size     | None                                 |
| visibility       | private                              |
+------------------+--------------------------------------+

更改镜像(控制节点)

 

使用glance image-update命令更新镜像信息

# glance image-update --min-disk=1 d2b3013e-4aac-4e4b-a506-a88de0e6bdad
+------------------+--------------------------------------+
| Property         | Value                                |
+------------------+--------------------------------------+
| checksum         | ee1eca47dc88f4879d8a229cc70a07c6     |
| container_format | bare                                 |
| created_at       | 2020-05-21T22:13:34Z                 |
| disk_format      | qcow2                                |
| id               | d2b3013e-4aac-4e4b-a506-a88de0e6bdad |
| min_disk         | 1                                    |
| min_ram          | 0                                    |
| name             | cirros                               |
| owner            | 81945ab408cf4c8e86fadc28a83d2d2d     |
| protected        | False                                |
| size             | 13287936                             |
| status           | active                               |
| tags             | []                                   |
| updated_at       | 2020-05-21T22:21:27Z                 |
| virtual_size     | None                                 |
| visibility       | private                              |
+------------------+--------------------------------------+

删除镜像(控制节点)

使用glance image-delete删除镜像信息

# glance image-delete d2b3013e-4aac-4e4b-a506-a88de0e6bdad

# glance image-list
+--------------------------------------+-----------+
| ID                                   | Name      |
+--------------------------------------+-----------+
| edd13c0b-9711-4ef8-9a27-c565ea511ba3 | centos7.2 |
+--------------------------------------+-----------+

Nova服务运维

计算服务(Nova)表示云平台的工作负载的核心。如果有些云服务的工作中不包括计算,那么它们充其量只代表静态存储,所有动态活动都会涉及一些计算元素。OpenStack Compute这个名称指的是一个特定的项目,该项目也被称为Nova,OpenStack的其他组件依托Nova,与Nova协同工作,组成了整个OpenStack云平台

Nova,是OpenStack计算的弹性控制器。Nova可以说是整个云平台最重要的组件,其功能包括运行虚拟机实例、管理网络以及通过用户和项目来控制对云的访问。OpenStack最基础的开源项目名字称为Nova,它提供的软件可以控制基础设施即服务(IaaS)云计算平台,与AmazonEC2和Rackspace云服务器有一定程度的相似。OpenStack Compute没有包含任何的虚拟化软件,相反,它定义和运行在主机操作系统上的虚拟化机制交互的驱动程序,并通过基于Web的程序应用接口(API)来提供功能的使用

Nova运维命令

Nova管理安全组规则

安全组(security group)是一些规则的集合,用来对虚拟机的访问流量加以限制,这反映到底层,就是使用iptables,给虚拟机所在的宿主机添加iptables规则。可以定义n个安全组,每个安全组可以有n个规则,可以给每个实例绑定n个安全组。Nova中总是有一个default安全组,这个是不能被删除的。创建实例的时候,如果不指定安全组,会默认使用这个default安全组。现在Nova中安全组应该会移到Neutron中,并且会增加对虚拟机外出流量的控制

创建安全组

# nova secgroup-create test 'test the nova command about the rules'

+--------------------------------------+------+---------------------------------------+

| Id                                   | Name | Description                           |

+--------------------------------------+------+---------------------------------------+

| d1ce4ef1-26c8-4b3d-958b-bc778bf283f3 | test | test the nova command about the rules |

+--------------------------------------+------+---------------------------------------+

Nova管理虚拟机类型(控制节点)

虚拟机类型是在创建实例的时候,分配给实例的资源情况

使用命令创建一个名为test,ID为6,内存为2048 MB,磁盘为20 GB,vCPU数量为2的云主机类型

# nova flavor-create test 6 2048 20 2

+----+------+-----------+------+-----------+------+-------+-------------+-----------+

| ID | Name | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public |

+----+------+-----------+------+-----------+------+-------+-------------+-----------+

| 6  | test | 2048      | 20   | 0         |      | 2     | 1.0         | True      |

+----+------+-----------+------+-----------+------+-------+-------------+-----------+

查看test云主机类型的详细信息

# nova flavor-show test

+----------------------------+-------+

| Property                   | Value |

+----------------------------+-------+

| OS-FLV-DISABLED:disabled   | False |

| OS-FLV-EXT-DATA:ephemeral  | 0     |

| disk                       | 20    |

| extra_specs                | {}    |

| id                         | 6     |

| name                       | test  |

| os-flavor-access:is_public | True  |

| ram                        | 2048  |

| rxtx_factor                | 1.0   |

| swap                       |       |

| vcpus                      | 2     |

+----------------------------+-------+

 

Nova实例管理 

启动实例

格式

nova boot [--flavor <flavor>] [--image <image>]

                 [--image-with <key=value>] [--boot-volume <volume_id>]

                 [--snapshot <snapshot_id>] [--min-count <number>]

                 [--max-count <number>] [--meta <key=value>]

                 [--file <dst-path=src-path>] [--key-name <key-name>]

                 [--user-data <user-data>]

                 [--availability-zone <availability-zone>]

                 [--security-groups <security-groups>]

                 [--block-device-mapping <dev-name=mapping>]

                 [--block-device key1=value1[,key2=value2...]]

                 [--swap <swap_size>]

                 [--ephemeral size=<size>[,format=<format>]]

                 [--hint <key=value>]

                 [--nic <net-id=net-uuid,net-name=network-name,v4-fixed-ip=ip-addr,v6-fixed-ip=ip-addr,port-id=port-uuid>]

                 [--config-drive <value>] [--poll] [--admin-pass <value>]

                 [--access-ip-v4 <value>] [--access-ip-v6 <value>]

                 [--description <description>]

                 <name>

固定参数

<name>:实例名称

可选参数

[--flavor <flavor>]:虚拟机类型。

[--image <image>]:选用的镜像。

[--image-with <key=value>] :镜像的元数据属性。

[--boot-volume <volume_id>:启动逻辑卷的ID。

[--snapshot <snapshot_id>] 快照

[--num-instances <number>] 实例数量

[--meta <key=value>]  元数据

[--file <dst-path=src-path>] 文件

[--key-name <key-name>] 密钥名称

[--user-data <user-data>] 注入的用户数据

[--availability-zone <availability-zone>] 可用域

[--security-groups <security-groups>] 安全组

[--block-device-mapping <dev-name=mapping>] 块存储格式化

[--block-device key1=value1[,key2=value2...]] 块设备参数

[--swap <swap_size>] 交换分区大小

[--ephemeral size=<size>[,format=<format>]]  连接块存储大小

[--hint <key=value>] 自定义数据

[--nic ] 配置IP

[--config-drive <value>] 驱动使能

[--poll] 显示创建进度

删除实例

格式

usage: nova delete [--all-tenants] <server> [<server> ...]

Immediately shut down and delete specified server(s).

Positional arguments:

  <server>       Name or ID of server(s).

Optional arguments:

  --all-tenants  Delete server(s) in another tenant by name (Admin only).

Neutron服务运维

Neutron网络目的是灵活地划分物理网络,在多租户环境下提供给每个租户独立的网络环境。它是可以被用户创建的对象,如果要和物理环境下的概念映射的话,这个对象相当于一个巨大的交换机,可以拥有无限多个动态可创建和销毁的虚拟端口

Neutron查询(控制节点)

使用Neutron相关命令查询网络服务的列表信息中的“binary”一列

# neutron agent-list -c binary
+---------------------------+
| binary                    |
+---------------------------+
| neutron-openvswitch-agent |
| neutron-lbaas-agent       |
| neutron-metadata-agent    |
| neutron-l3-agent          |
| neutron-metadata-agent    |
| neutron-openvswitch-agent |
| neutron-dhcp-agent        |
+---------------------------+

 

查询网络详情(控制节点)

# neutron net-list
+-----------------------------------+---------+------------------------------------+
| id                                | name    | subnets                            |
+-----------------------------------+---------+------------------------------------+
| 9e923ba3-b584-47bc-9bca-          | int-gre | f3d75dd9-4970-402b-                |
| eef0e49d1efe                      |         | bdd6-f34e0cab877b 10.10.0.0/24     |
| 77654301-f079-40b2-8658-3087c4dd3 | net-gre | 473b2662-6dcd-494e-ab7f-           |
| 6fb                               |         | e0a7f80ba0ee 192.168.20.0/24       |
+-----------------------------------+---------+------------------------------------+
 

查询Neutron相关组件服务(控制节点)

使用Neutron相关命令查询网络服务DHCP agent的详细信息

# neutron agent-list
+-----------+------------+-----------+-------------------+-------+----------------+--------------+
| id        | agent_type | host      | availability_zone | alive | admin_state_up | binary       |
+-----------+------------+-----------+-------------------+-------+----------------+--------------+
| 46c9dd95- | Open       | compute   |                   | :-)   | True           | neutron-     |
| 66a0      | vSwitch    |           |                   |       |                | openvswitch- |
| -4e5a-    | agent      |           |                   |       |                | agent        |
| 8b8d-0762 |            |           |                   |       |                |              |
| 62e4b7a0  |            |           |                   |       |                |              |
| 7d210742- | Loadbalanc | controlle |                   | xxx   | True           | neutron-     |
| f656-42a9 | er agent   | r         |                   |       |                | lbaas-agent  |
| -9103-ba1 |            |           |                   |       |                |              |
| 4a36e4ad2 |            |           |                   |       |                |              |
| a3899944  | Metadata   | controlle |                   | :-)   | True           | neutron-     |
| -245f-    | agent      | r         |                   |       |                | metadata-    |
| 407a-     |            |           |                   |       |                | agent        |
| abfe-2914 |            |           |                   |       |                |              |
| 0779e2ee  |            |           |                   |       |                |              |
| abd22fd2- | L3 agent   | controlle | nova              | :-)   | True           | neutron-l3-a |
| 50f4-4997 |            | r         |                   |       |                | gent         |
| -b3bf-923 |            |           |                   |       |                |              |
| 2785e15a5 |            |           |                   |       |                |              |
| c407a59a- | Metadata   | compute   |                   | :-)   | True           | neutron-     |
| 59cb-45f1 | agent      |           |                   |       |                | metadata-    |
| -9ff5-211 |            |           |                   |       |                | agent        |
| 51799c344 |            |           |                   |       |                |              |
| def73e89  | Open       | controlle |                   | :-)   | True           | neutron-     |
| -27ba-    | vSwitch    | r         |                   |       |                | openvswitch- |
| 4b52      | agent      |           |                   |       |                | agent        |
| -88db-580 |            |           |                   |       |                |              |
| d30419ea0 |            |           |                   |       |                |              |
| f4772d45- | DHCP agent | controlle | nova              | :-)   | True           | neutron-     |
| 95a4-49d4 |            | r         |                   |       |                | dhcp-agent   |
| -b69c-296 |            |           |                   |       |                |              |
| 7a037649d |            |           |                   |       |                |              |
+-----------+------------+-----------+-------------------+-------+----------------+--------------+

Cinder服务运维

Cinder是OpenStack Block Storage(OpenStack块存储)的项目名称,Cinder的核心功能是对卷的管理,允许对卷、卷的类型、快照进行处理。然而,它并没有实现对块设备的管理和实际服务(提供逻辑卷),而是通过后端的统一存储接口,支持不同块设备厂商的块存储服务,实现其驱动支持并于OpenStack进行整合。Cinder可以支持如NetAPP、SolidFire、华为、EMC和IBM等知名存储厂商以及众多开源块存储系统

创建云硬盘(控制节点)

创建一个2 GB的云硬盘extend-demo

 

# cinder create --name cinder-volume-demo 2
+--------------------------------+--------------------------------------+
|            Property            |                Value                 |
+--------------------------------+--------------------------------------+
|          attachments           |                  []                  |
|       availability_zone        |                 nova                 |
|            bootable            |                false                 |
|      consistencygroup_id       |                 None                 |
|           created_at           |      2020-05-21T23:01:01.000000      |
|          description           |                 None                 |
|           encrypted            |                False                 |
|               id               | 22585efe-a7a5-49df-b942-096e0ff57a71 |
|            metadata            |                  {}                  |
|        migration_status        |                 None                 |
|          multiattach           |                False                 |
|              name              |          cinder-volume-demo          |
|     os-vol-host-attr:host      |                 None                 |
| os-vol-mig-status-attr:migstat |                 None                 |
| os-vol-mig-status-attr:name_id |                 None                 |
|  os-vol-tenant-attr:tenant_id  |   81945ab408cf4c8e86fadc28a83d2d2d   |
|       replication_status       |               disabled               |
|              size              |                  2                   |
|          snapshot_id           |                 None                 |
|          source_volid          |                 None                 |
|             status             |               creating               |
|           updated_at           |                 None                 |
|            user_id             |   b2ea672397fa40849b3b65ae6dd72f6a   |
|          volume_type           |                 None                 |
+--------------------------------+--------------------------------------+

通过cinder-list命令查看云硬盘信息

# cinder list
+--------------------------------------+--------+--------------------+------+-------------+----------+-------------+
|                  ID                  | Status |        Name        | Size | Volume Type | Bootable | Attached to |
+--------------------------------------+--------+--------------------+------+-------------+----------+-------------+
| 22585efe-a7a5-49df-b942-096e0ff57a71 | error  | cinder-volume-demo |  2   |      -      |  false   |             |
+--------------------------------------+--------+--------------------+------+-------------+----------+-------------+

创建云硬盘卷类型(控制节点)

创建type标识的卷类型

# cinder type-create lvm
+--------------------------------------+------+-------------+-----------+
|                  ID                  | Name | Description | Is_Public |
+--------------------------------------+------+-------------+-----------+
| f4aad652-c573-495a-8199-9ec15122a378 | lvm  |      -      |    True   |
+--------------------------------------+------+-------------+-----------+

查看现有的卷类型

# cinder type-create lvm
+--------------------------------------+------+-------------+-----------+
|                  ID                  | Name | Description | Is_Public |
+--------------------------------------+------+-------------+-----------+
| f4aad652-c573-495a-8199-9ec15122a378 | lvm  |      -      |    True   |
+--------------------------------------+------+-------------+-----------+
[root@controller ~]# cinder type-list
+--------------------------------------+------+-------------+-----------+
|                  ID                  | Name | Description | Is_Public |
+--------------------------------------+------+-------------+-----------+
| f4aad652-c573-495a-8199-9ec15122a378 | lvm  |      -      |    True   |
+--------------------------------------+------+-------------+-----------+

创建带标识云硬盘(控制节点)

创建一块带“lvm”标识的云硬盘

# cinder create --name type_test_demo --volume-type lvm 1
+--------------------------------+--------------------------------------+
|            Property            |                Value                 |
+--------------------------------+--------------------------------------+
|          attachments           |                  []                  |
|       availability_zone        |                 nova                 |
|            bootable            |                false                 |
|      consistencygroup_id       |                 None                 |
|           created_at           |      2020-05-21T23:06:04.000000      |
|          description           |                 None                 |
|           encrypted            |                False                 |
|               id               | e74a9773-65fd-4183-9cee-ad3911e8461b |
|            metadata            |                  {}                  |
|        migration_status        |                 None                 |
|          multiattach           |                False                 |
|              name              |            type_test_demo            |
|     os-vol-host-attr:host      |                 None                 |
| os-vol-mig-status-attr:migstat |                 None                 |
| os-vol-mig-status-attr:name_id |                 None                 |
|  os-vol-tenant-attr:tenant_id  |   81945ab408cf4c8e86fadc28a83d2d2d   |
|       replication_status       |               disabled               |
|              size              |                  1                   |
|          snapshot_id           |                 None                 |
|          source_volid          |                 None                 |
|             status             |               creating               |
|           updated_at           |                 None                 |
|            user_id             |   b2ea672397fa40849b3b65ae6dd72f6a   |
|          volume_type           |                 lvm                  |
+--------------------------------+--------------------------------------+

查询信息,看到该卷的volume_type字段已修改为“lvm”

# cinder show type_test_demo
+--------------------------------+--------------------------------------+
|            Property            |                Value                 |
+--------------------------------+--------------------------------------+
|          attachments           |                  []                  |
|       availability_zone        |                 nova                 |
|            bootable            |                false                 |
|      consistencygroup_id       |                 None                 |
|           created_at           |      2020-05-21T23:06:04.000000      |
|          description           |                 None                 |
|           encrypted            |                False                 |
|               id               | e74a9773-65fd-4183-9cee-ad3911e8461b |
|            metadata            |                  {}                  |
|        migration_status        |                 None                 |
|          multiattach           |                False                 |
|              name              |            type_test_demo            |
|     os-vol-host-attr:host      |                 None                 |
| os-vol-mig-status-attr:migstat |                 None                 |
| os-vol-mig-status-attr:name_id |                 None                 |
|  os-vol-tenant-attr:tenant_id  |   81945ab408cf4c8e86fadc28a83d2d2d   |
|       replication_status       |               disabled               |
|              size              |                  1                   |
|          snapshot_id           |                 None                 |
|          source_volid          |                 None                 |
|             status             |                error                 |
|           updated_at           |      2020-05-21T23:06:06.000000      |
|            user_id             |   b2ea672397fa40849b3b65ae6dd72f6a   |
|          volume_type           |                 lvm                  |
+--------------------------------+--------------------------------------+

删除指定的Cinder卷

# cinder delete cinder-volume-demo
Request to delete volume cinder-volume-demo has been accepted.

Swift服务运维

Swift构筑在比较便宜的标准硬件存储基础设施之上,无需采用RAID(磁盘冗余阵列),通过在软件层面引入一致性散列技术提高数据冗余性、高可用性和可伸缩性,支持多租户模式、容器和对象读写操作,适合解决互联网的应用场景下非结构化数据存储问题。在OpenStack中,Swift主要用于存储虚拟机镜像,用于Glance的后端存储。在实际运用中,Swift的典型运用是网盘系统,代表是“Dropbox”,存储类型大多为图片、邮件、视频和存储备份等静态资源

Swift查询命令(控制节点)

创建容器

需要创建一个名称为“test”的容器

# swift post test

查询容器

查看“test”容器里面的内容

# swift list test 

创建file目录

# mkdir file

# touch one.txt

# touch two.doc

# touch three.png

Swift上传和下载(控制节点)

上传文件至容器

上传一个空白的“file”目录

# swift upload test file/
file/

one.txt文件上传到“test”容器内file目录内

# swift upload test/file one.txt
file/one.txt

将剩下的two.doc和three.png递归上传到“test”容器下的file目录内

 

# mv two.doc three.png file/

# swift upload test file/
file/three.png
file/two.doc

从容器中下载文件

数据在Swift集群内保存,随时供用户下载使用

# swift download test file/three.png
file/three.png [auth 2.329s, headers 2.725s, total 2.726s, 0.000 MB/s]

从容器中删除文件

磁盘容量有限,需要删除一些相对价值低的数据,空出更多的空间

# swift delete test file/three.png
file/three.png

查看容器服务状态

通过swift stat命令来查看整个Account账户下Swift状态

# swift stat
                        Account: AUTH_81945ab408cf4c8e86fadc28a83d2d2d
                     Containers: 1
                        Objects: 4
                          Bytes: 0
Containers in policy "policy-0": 1
   Objects in policy "policy-0": 4
     Bytes in policy "policy-0": 0
    X-Account-Project-Domain-Id: 1b3296609d0b4f82a7734e5439033935
                    X-Timestamp: 1590102621.65325
                     X-Trans-Id: txe6c38a6ca5e342d09321e-005ec70c3e
                   Content-Type: text/plain; charset=utf-8
                  Accept-Ranges: bytes

构建LNMP+WordPress

使用创建的云主机进行操作

安装LNMP环境

修改主机名

# hostnamectl set-hostname lnmp

上传软件包

将提供的lnmp1.6-full.tar.gz软件包,上传到虚拟机的/root目录下,并解压

# tar -zxvf lnmp1.6-full.tar.gz

配置DNS

# vi /etc/sysconfig/network-scripts/ifcfg-eth0

DNS="114.114.114.114"

执行安装脚本

# cd lnmp1.6-full

# ./install.sh

选择默认(Default)的软件安装版本,设置数据库密码

安装成功后按Ctrl+C退出 

使用浏览器输入ip查看页面

 

部署WordPress应用 

数据库基础配置

登录数据库

# mysql -uroot -p123456

创建数据库

> create database wordpress;

赋予远程权限

> grant all privileges on *.* to root@localhost identified by'123456' with grant option;

> grant all privileges on *.* to root@"%" identified by'123456' with grant option;

压缩包基础配置

将提供的wordpress-4.7.3-zh_CN.zip压缩包上传至/root目录并解压

# unzip wordpress-4.7.3-zh_CN.zip

删除nginx项目的默认页面

# cd /home/wwwroot/default/

# rm -rf index.html

复制文件

# cd /root/wordpress

# cp -rvf * /home/wwwroot/default/

赋予权限

# cd /home/wwwroot/default/

# chmod 777 *

将模板配置文件复制并改名

# cp wp-config-sample.php wp-config.php

编辑模板配置文件

# vi wp-config.php

// ** MySQL 设置 - 具体信息来自您正在使用的主机 ** //
/** WordPress数据库的名称 */
define('DB_NAME', 'wordpress'); /** MySQL数据库用户名 */
define('DB_USER', 'root'); /** MySQL数据库密码 */
define('DB_PASSWORD', '123456'); /** MySQL主机 */
define('DB_HOST', '127.0.0.1'); /** 创建数据表时默认的文字编码 */
define('DB_CHARSET', 'utf8'); /** 数据库整理类型。如不确定请勿更改 */
define('DB_COLLATE', '');

浏览器配置

浏览器输入ip进入WordPress安装页面

 

点击安装之后刷新页面

 点击登录,输入用户名密码

进入WordPress应用的后台仪表盘界面,点击左上角myblog

 

WordPress应用部署完毕 

 


原文链接:https://www.cnblogs.com/tui463/p/12890082.html
如有疑问请与原作者联系

标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇:k3s-多种安装方式任你选-满足多种场景需要

下一篇:CentOS安装Docker