首页
归档
时光轴
推荐
Cloud
图床
导航
Search
1
Deploy OpenStack offline based on Kolla
738 阅读
2
openstact 基础环境安装 (手动版)
687 阅读
3
Mariadb 主从复制&读写分离
642 阅读
4
Typecho 1.2.0 部署
640 阅读
5
FusionCompute8.0 体验
573 阅读
Python
Linux
随笔
mysql
openstack
Search
标签搜索
linux
Pike
python
爬虫
openstack
mysql
Essay
Ansible
docker
Zabbix
kolla
Internet
Redis
1+X
Hyper-V
jenkins
Kickstart
自动化
sh
pxe
Acha
累计撰写
77
篇文章
累计收到
1
条评论
首页
栏目
Python
Linux
随笔
mysql
openstack
页面
归档
时光轴
推荐
Cloud
图床
导航
搜索到
77
篇与
的结果
2021-12-04
1+X 云计算初级( 操作题 )
1+X 初级 by 王政(blog http://blog.youto.club) # 说明: 本次视频,只做文档演示,没有详细讲解 # 视频地址:https://www.bilibili.com/video/BV1hL411M72w 1+X 初级 环境准备 网络服务 本地YUM源管理 FTP安装使用 Samba管理 NFS 服务管理 主从数据库管理 部署WordPress应用 拓展 LVM 数据库管理 MariaDB管理 Openstack运维 OpenStack Keystone管理 OpenStack Glance管理 OpenStack Cinder管理 OpenStack Nova管理 OpenStack Swift管理 Docker Docker安装 Docker运维 Docker管理 Dockerfile编写 Dockerfile 编写 部署Swarm集群 环境准备 yum源 selinux & firewalld hostname hosts 网络服务 本地YUM源管理 使用VMWare软件启动提供的xserver1虚拟机(配置虚拟机xserver1的IP为192.168.100.11,主机名为xserver1),在虚拟机的/root目录下,存在一个CentOS-7-x86_64-DVD-1511.iso的镜像文件,使用这个镜像文件配置本地yum源,要求将这个镜像文件挂在/opt/centos目录,请问如何配置自己的local.repo文件,使得可以使用该镜像中的软件包,安装软件。请将local.repo文件的内容以文本形式提交到答题框。 [root@xserver1 ~]# mkdir /opt/centos [root@xserver1 ~]# mount -o loop CentOS-7-x86_64-DVD-1511.iso /opt/centos/ mount: /dev/loop0 is write-protected, mounting read-only [root@xserver1 ~]# rm -f /etc/yum.repos.d/* [root@xserver1 ~]# cat /etc/yum.repos.d/local.repo [centos] name=centos baseurl=file:///opt/centos gpgcheck=0 enabled=1 # 答题框 [root@xserver1 ~]# cat /etc/yum.repos.d/local.repo [centos] name=centos baseurl=file:///opt/centos gpgcheck=0 enabled=1 FTP安装使用 使用xserver1虚拟机,安装ftp服务,并配置ftp的共享目录为/opt。使用VMWare软件继续启动提供的xserver2虚拟机(配置虚拟机xserver2的IP为192.168.100.12,主机名为xserver2),并创建该虚拟机的yum源文件ftp.repo使用xserver1的ftp源(配置文件中的FTP地址使用主机名)。配置完成后,将xserver2节点的ftp.repo文件以文本形式提交到答题框。 yum install -y vsftpd echo "anon_root=/opt/" >> /etc/vsftpd/vsftpd.conf systemctl start vsftpd && systemctl enable vsftpd [root@xserver2 ~]# cat /etc/yum.repos.d/ftp.repo [centos] name=centos baseurl=ftp://xserver1/centos gpgcheck=0 enabled=1 # 答题框 [root@xserver2 ~]# cat /etc/yum.repos.d/ftp.repo [centos] name=centos baseurl=ftp://xserver1/centos gpgcheck=0 enabled=1 Samba管理 使用xserver1虚拟机,安装Samba服务所需要的软件包,将xserver1节点中的/opt/share目录使用Samba服务共享出来(目录不存在请自行创建)。操作完毕后,将xserver1节点Samba配置文件中的[share]段落和执行netstat -ntpl命令的返回结果以文本形式提交到答题框。 yum install -y samba vi /etc/samba/smb.conf # 添加 [share] comment = Share Directories path=/opt/share writable = yes systemctl restart smb # 答题框 [share] comment = Share Directories path=/opt/share writable = yes [root@xserver1 ~]# netstat -nltp Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:139 0.0.0.0:* LISTEN 3527/smbd tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1429/sshd tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1944/master tcp 0 0 0.0.0.0:445 0.0.0.0:* LISTEN 3527/smbd tcp6 0 0 :::139 :::* LISTEN 3527/smbd tcp6 0 0 :::21 :::* LISTEN 3280/vsftpd tcp6 0 0 :::22 :::* LISTEN 1429/sshd tcp6 0 0 ::1:25 :::* LISTEN 1944/master tcp6 0 0 :::445 :::* LISTEN 3527/smbd NFS 服务管理 使用 xserver1、xserver2 虚拟机,安装 NFS 服务所需要的软件包,将 xserver1 节点中的/mnt/share 目录使用 NFS 服务共享出来(目录不存在请自行创建,要求可访问共享目录的网段为 192.168.100.0/24),接着在 xserver2 节点上,将 xserver1中共享的文件挂载到/mnt 目录下。操作完毕后,依次将 xserver1 节点上执行showmount -e ip 命令和 xserver2 节点上执行 df -h 命令的返回结果(简要)写到下方 # xserver1 yum search nfs yum install -y nfs-utils mkdir /mnt/share man exports vi /etc/exports # 添加 /mnt/share 192.168.100.0/24(rw,sync) systemctl start nfs-server rpcbind exportfs -r showmount -e 192.168.100.11 # xserver2 yum install -y nfs-utils mount 192.168.100.11:/mnt/share /mnt/ df -h # 答题框 [root@xserver1 ~]# showmount -e 192.168.100.11 Export list for 192.168.100.11: /mnt/share 192.168.100.0/24 [root@xserver2 ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/centos-root 36G 951M 35G 3% / devtmpfs 1.9G 0 1.9G 0% /dev tmpfs 1.9G 0 1.9G 0% /dev/shm tmpfs 1.9G 8.7M 1.9G 1% /run tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup /dev/sda1 497M 114M 384M 23% /boot tmpfs 378M 0 378M 0% /run/user/0 192.168.100.11:/mnt/share 36G 7.7G 28G 22% /mnt 主从数据库管理 在xserver1、xserver2上安装mariadb数据库,并配置为主从数据库(xserver1为主节点、xserver2为从节点),实现两个数据库的主从同步。配置完毕后,请在xserver2上的数据库中执行“show slave status \G”命令查询从节点复制状态,将查询到的结果以文本形式提交到答题框。 ## xserver1 yum install -y mariadb-server systemctl start mariadb mysql_secure_installation mysql -uroot -p000000 MariaDB [(none)]> GRANT ALL privileges ON *.* TO 'root'@'%' IDENTIFIED BY '000000'; MariaDB [(none)]> GRANT replication slave ON *.* TO 'user'@'xserver2' IDENTIFIED BY '000000'; vi /etc/my.cnf # 在第二行添加 log_bin=mysql-bin server_id=11 systemctl restart mariadb ## xserver2 yum install -y mariadb-server systemctl start mariadb mysql_secure_installation vi /etc/my.cnf # 在第二行添加 log_bin=mysql-bin server_id=12 systemctl restart mariadb mysql -uroot -p000000 MariaDB [(none)]> CHANGE MASTER TO MASTER_HOST='xserver1',MASTER_USER='user',MASTER_PASSWORD='000000'; MariaDB [(none)]> start slave; MariaDB [(none)]> show slave status \G # 答题框 MariaDB [(none)]> show slave status \G *************************** 1. row *************************** Slave_IO_State: Waiting for master to send event Master_Host: xserver1 Master_User: user Master_Port: 3306 Connect_Retry: 60 Master_Log_File: mysql-bin.000001 Read_Master_Log_Pos: 245 Relay_Log_File: mariadb-relay-bin.000003 Relay_Log_Pos: 529 Relay_Master_Log_File: mysql-bin.000001 Slave_IO_Running: Yes Slave_SQL_Running: Yes Replicate_Do_DB: Replicate_Ignore_DB: Replicate_Do_Table: Replicate_Ignore_Table: Replicate_Wild_Do_Table: Replicate_Wild_Ignore_Table: Last_Errno: 0 Last_Error: Skip_Counter: 0 Exec_Master_Log_Pos: 245 Relay_Log_Space: 825 Until_Condition: None Until_Log_File: Until_Log_Pos: 0 Master_SSL_Allowed: No Master_SSL_CA_File: Master_SSL_CA_Path: Master_SSL_Cert: Master_SSL_Cipher: Master_SSL_Key: Seconds_Behind_Master: 0 Master_SSL_Verify_Server_Cert: No Last_IO_Errno: 0 Last_IO_Error: Last_SQL_Errno: 0 Last_SQL_Error: Replicate_Ignore_Server_Ids: Master_Server_Id: 11 1 row in set (0.00 sec) 部署WordPress应用 使用xserver1节点,基于lnmp环境,部署WordPress应用(WordPress源码包在/root目录下)。应用部署完毕后,设置WordPress的站点标题为自己的姓名(例:名字叫张三,则设置站点标题为张三的BLOG),设置完毕后登录WordPresss首页。最后将命令curl ip(ip为wordpress的首页ip)的返回结果以文本形式提交到答题框。 # xserver1 vi /etc/yum.repos.d/local.repo i # 添加 [lnmp] name=lnmp baseurl=file:///root/lnmp gpgcheck=0 enabled=1 yum repolist yum install -y nginx php php-fpm php-mysql vi /etc/php-fpm.d/www.conf # 修改 39 user = nginx 41 group = nginx vi /etc/nginx/conf.d/default.conf # 修改 10 index index.php index.html index.htm; 30 location ~ \.php$ { 31 root /usr/share/nginx/html; 32 fastcgi_pass 127.0.0.1:9000; 33 fastcgi_index index.php; 34 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 35 include fastcgi_params; 36 } systemctl start nginx php-fpm [root@xserver1 ~]# mysql -uroot -p000000 MariaDB [(none)]> create database wordpress; rm -f /usr/share/nginx/html/* yum install -y unzip unzip wordpress-4.7.3-zh_CN.zip cp -r wordpress/* /usr/share/nginx/html/ ls /usr/share/nginx/html/ chown -R nginx.nginx /usr/share/nginx/html/ cp /usr/share/nginx/html/wp-config-sample.php /usr/share/nginx/html/wp-config.php vi /usr/share/nginx/html/wp-config.php # 修改 23 define('DB_NAME', 'wordpress'); 26 define('DB_USER', 'root'); 29 define('DB_PASSWORD', '000000'); # 使用浏览访问 IP,设置标题 数字表示行号 tip: 在 vi中 :set nu 显示行号 拓展 LVM # 解题步骤: 1. 添加硬盘,并分区 2. 创建 PV 3. 创建 VG 4. 创建 LV 5. 格式化,挂载 使用xserver1虚拟机,使用VMWare软件自行添加一块大小为20G的硬盘,使用fdisk命令对该硬盘进形分区,要求分出三个大小为5G的分区。使用这三个分区,创建名xcloudvg的卷组。然后创建名xcloudlv的逻辑卷,大小为12G,再创建完之后,使用命令将逻辑卷大小缩小2G,然后查看逻辑卷信息。将上述所有操作命令和返回结果以文本形式提交到答题框。 [root@xserver2 ~]# lsblk [root@xserver2 ~]# fdisk /dev/sdb # n 默认回车 大小设置:+5G 重复三次 [root@xserver2 ~]# pvcreate /dev/sdb[1-3] [root@xserver2 ~]# vgcreate xcloudvg /dev/sdb[1-3] [root@xserver2 ~]# lvcreate -L 12G -n xcloudlv xcloudvg [root@xserver2 ~]# lvreduce -L -2G /dev/mapper/xcloudvg-xcloudlv [root@xserver2 ~]# lvdisplay 使用VMware软件和提供的CentOS-7-x86_64-DVD-1511.iso创建虚拟机,自行配置好网络并多添加一块大小为20G的硬盘,使用fdisk命令对该硬盘进形分区,要求分出三个大小为5G的分区。使用这三个分区,创建名xcloudvg的卷组。然后创建名xcloudlv的逻辑卷,大小为12G,最后用xfs文件系统对逻辑卷进行格式化并挂载到/mnt目录下。将上述所有操作命令和返回结果以文本形式提交到答题框。 [root@xserver2 ~]# lsblk [root@xserver2 ~]# fdisk /dev/sdb # n 默认回车 大小设置:+5G 重复三次 [root@xserver2 ~]# pvcreate /dev/sdb1 /dev/sdb2 /dev/sdb3 [root@xserver2 ~]# vgcreate xcloudvg /dev/sdb[1-3] [root@xserver2 ~]# lvcreate -L 12G -n xcloudlv xcloudvg [root@xserver2 ~]# mkfs.xfs /dev/xcloudvg/xcloudlv [root@xserver2 ~]# mkdir /data [root@xserver2 ~]# mount -o loop /dev/xcloudvg/xcloudlv /mnt [root@xserver2 ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/centos-root 36G 872M 35G 3% / devtmpfs 1.9G 0 1.9G 0% /dev tmpfs 1.9G 0 1.9G 0% /dev/shm tmpfs 1.9G 8.6M 1.9G 1% /run tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup /dev/sda1 497M 114M 384M 23% /boot tmpfs 378M 0 378M 0% /run/user/0 /dev/loop0 12G 33M 12G 1% /mnt 使用xserver1虚拟机,使用VMWare软件自行添加一块大小为20G的硬盘,使用fdisk命令对该硬盘进形分区,要求分出两个大小为5G的分区。使用两个分区,创建名xcloudvg的卷组并指定PE大小为16 MB。将执行vgdisplay命令的返回结果以文本形式提交到答题框。 [root@xserver1 ~]# fdisk /dev/sdb # n 默认回车 大小设置:+5G 重复三次 [root@xserver1 ~]# pvcreate /dev/sdb1 /dev/sdb2 [root@xserver1 ~]# vgcreate xcloudvg -s 16 /dev/sdb1 /dev/sdb2 [root@xserver1 ~]# vgdisplay 数据库管理 使用提供的“all-in-one”虚拟机,进入数据库。 (1)创建本地用户examuser,密码为000000; (2)查询mysql数据库中的user表的host,user,password字段;(3)赋予这个用户对所有数据库拥有“查询”“删除”“更新”“创建”的本地权限。依次将操作命令和返回结果以文本形式提交到答题框。 [root@xserver1 ~]# mysql -uroot -p000000 MariaDB [mysql]> create user examuser@localhost identified by '000000'; Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> use mysql MariaDB [mysql]> select host,user,password from user; +-----------+----------+-------------------------------------------+ | host | user | password | +-----------+----------+-------------------------------------------+ | localhost | root | *032197AE5731D4664921A6CCAC7CFCE6A0698693 | | xserver1 | root | *032197AE5731D4664921A6CCAC7CFCE6A0698693 | | 127.0.0.1 | root | *032197AE5731D4664921A6CCAC7CFCE6A0698693 | | ::1 | root | *032197AE5731D4664921A6CCAC7CFCE6A0698693 | | % | root | *032197AE5731D4664921A6CCAC7CFCE6A0698693 | | xserver2 | user | *032197AE5731D4664921A6CCAC7CFCE6A0698693 | | localhost | examuser | *032197AE5731D4664921A6CCAC7CFCE6A0698693 | +-----------+----------+-------------------------------------------+ 7 rows in set (0.00 sec) MariaDB [mysql]> grant SELECT,DELETE,UPDATE,CREATE on *.* to examuser@localhost; Query OK, 0 rows affected (0.00 sec) MariaDB管理 使用VMware软件和提供的CentOS-7-x86_64-DVD-1511.iso创建虚拟机,自行配置好网络和YUM源,安装mariadb数据库,安装完毕后登数据库,查询当前系统的时间和用户。依次将操作命令和返回结果以文本形式提交到答题框。(数据库用户名root,密码000000;关于数据库的命令均使用小写) [root@xserver1 ~]# mysql -uroot -p000000 MariaDB [(none)]> select user() ,now(); +----------------+---------------------+ | user() | now() | +----------------+---------------------+ | root@localhost | 2021-11-17 15:05:08 | +----------------+---------------------+ 1 row in set (0.00 sec) Openstack运维 OpenStack Keystone管理 使用提供的“all-in-one”虚拟机,创建用户testuser,密码为xiandian,将testuser用户分配给admin项目,赋予用户admin的权限。依次将操作命令和查询结果以文本形式提交到答题框。 [root@controller ~]# openstack user create --password xiandian --project admin --domain xiandian testuser +--------------------+----------------------------------+ | Field | Value | +--------------------+----------------------------------+ | default_project_id | f9ff39ba9daa4e5a8fee1fc50e2d2b34 | | domain_id | 9321f21a94ef4f85993e92a228892418 | | enabled | True | | id | 806b2c56147e41699ddd89af955a6f20 | | name | testuser | +--------------------+----------------------------------+ OpenStack Glance管理 使用VMWare软件启动提供的opensatckallinone镜像,自行检查openstack中各服务的状态,若有问题自行排查。在xserver1节点的/root目录下存在一个cirros-0.3.4-x86_64-disk.img镜像;使用glance命令将镜像上传,并命名为mycirros,最后将glance image-show id命令的返回结果以文本形式提交到答题框。 [root@controller ~]# scp 192.168.100.11:/root/cirros-0.3.4-x86_64-disk.img . [root@controller ~]# glance image-create --name mycirros --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 | 2021-11-24T15:54:45Z | | disk_format | qcow2 | | id | 45d98d72-b23f-464d-b66e-13f154eed216 | | min_disk | 0 | | min_ram | 0 | | name | mycirros | | owner | f9ff39ba9daa4e5a8fee1fc50e2d2b34 | | protected | False | | size | 13287936 | | status | active | | tags | [] | | updated_at | 2021-11-24T15:54:45Z | | virtual_size | None | | visibility | private | +------------------+--------------------------------------+ [root@controller ~]# glance image-show 45d98d72-b23f-464d-b66e-13f154eed216 +------------------+--------------------------------------+ | Property | Value | +------------------+--------------------------------------+ | checksum | ee1eca47dc88f4879d8a229cc70a07c6 | | container_format | bare | | created_at | 2021-11-24T15:54:45Z | | disk_format | qcow2 | | id | 45d98d72-b23f-464d-b66e-13f154eed216 | | min_disk | 0 | | min_ram | 0 | | name | mycirros | | owner | f9ff39ba9daa4e5a8fee1fc50e2d2b34 | | protected | False | | size | 13287936 | | status | active | | tags | [] | | updated_at | 2021-11-24T15:54:45Z | | virtual_size | None | | visibility | private | +------------------+--------------------------------------+ OpenStack Cinder管理 使用VMWare软件启动提供的opensatckallinone镜像,自行检查openstack中各服务的状态,若有问题自行排查。使用Cinder服务,创建名为“ lvm”的卷类型,然后创建一块带“lvm” 标识的云硬盘,名称为 BlockVloume,大小为 2G,查询该云硬盘详细信息。完成后,将cinder show BlockVloume命令的返回结果以文本形式提交到答题框。 [root@controller ~]# cinder type-create lvm +--------------------------------------+------+-------------+-----------+ | ID | Name | Description | Is_Public | +--------------------------------------+------+-------------+-----------+ | caad5c75-59e3-4167-ad15-19e9f27cee6f | lvm | - | True | +--------------------------------------+------+-------------+-----------+ [root@controller ~]# cinder create --name BlockVloume --volume-type lvm 2 +--------------------------------+--------------------------------------+ | Property | Value | +--------------------------------+--------------------------------------+ | attachments | [] | | availability_zone | nova | | bootable | false | | consistencygroup_id | None | | created_at | 2021-11-24T15:57:22.000000 | | description | None | | encrypted | False | | id | d013e4b2-b0b8-41b4-95e3-2bd47f3431fa | | metadata | {} | | migration_status | None | | multiattach | False | | name | BlockVloume | | 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 | f9ff39ba9daa4e5a8fee1fc50e2d2b34 | | replication_status | disabled | | size | 2 | | snapshot_id | None | | source_volid | None | | status | creating | | updated_at | None | | user_id | 0befa70f767848e39df8224107b71858 | | volume_type | lvm | +--------------------------------+--------------------------------------+ [root@controller ~]# cinder show d013e4b2-b0b8-41b4-95e3-2bd47f3431fa +--------------------------------+--------------------------------------+ | Property | Value | +--------------------------------+--------------------------------------+ | attachments | [] | | availability_zone | nova | | bootable | false | | consistencygroup_id | None | | created_at | 2021-11-24T15:57:22.000000 | | description | None | | encrypted | False | | id | d013e4b2-b0b8-41b4-95e3-2bd47f3431fa | | metadata | {} | | migration_status | None | | multiattach | False | | name | BlockVloume | | os-vol-host-attr:host | controller@lvm#LVM | | os-vol-mig-status-attr:migstat | None | | os-vol-mig-status-attr:name_id | None | | os-vol-tenant-attr:tenant_id | f9ff39ba9daa4e5a8fee1fc50e2d2b34 | | replication_status | disabled | | size | 2 | | snapshot_id | None | | source_volid | None | | status | available | | updated_at | 2021-11-24T15:57:23.000000 | | user_id | 0befa70f767848e39df8224107b71858 | | volume_type | lvm | +--------------------------------+--------------------------------------+ OpenStack Nova管理 使用提供的“all-in-one”虚拟机,通过nova的相关命令创建名为exam,ID为1234,内存为1024M,硬盘为20G,虚拟内核数量为2的云主机类型,查看exam的详细信息。依次将操作命令及返回结果以文本形式提交到答题框。 [root@controller ~]# nova flavor-create exam 1234 1024 20 2 +------+------+-----------+------+-----------+------+-------+-------------+-----------+ | ID | Name | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public | +------+------+-----------+------+-----------+------+-------+-------------+-----------+ | 1234 | exam | 1024 | 20 | 0 | | 2 | 1.0 | True | +------+------+-----------+------+-----------+------+-------+-------------+-----------+ [root@controller ~]# nova flavor-show exam +----------------------------+-------+ | Property | Value | +----------------------------+-------+ | OS-FLV-DISABLED:disabled | False | | OS-FLV-EXT-DATA:ephemeral | 0 | | disk | 20 | | extra_specs | {} | | id | 1234 | | name | exam | | os-flavor-access:is_public | True | | ram | 1024 | | rxtx_factor | 1.0 | | swap | | | vcpus | 2 | +----------------------------+-------+ OpenStack Nova管理 使用VMWare软件启动提供的opensatckallinone镜像,自行检查openstack中各服务的状态,若有问题自行排查。使用nova相关命令,查询nova所有的监控列表,并查看ID为1的监控主机的详细信息,将操作命令和返回结果以文本形式提交到答题框。 [root@controller ~]# nova hypervisor-list +----+---------------------+-------+---------+ | ID | Hypervisor hostname | State | Status | +----+---------------------+-------+---------+ | 1 | controller | up | enabled | +----+---------------------+-------+---------+ [root@controller ~]# nova hypervisor-show 1 +---------------------------+------------------------------------------+ | Property | Value | +---------------------------+------------------------------------------+ | cpu_info_arch | x86_64 | | cpu_info_features | ["smap", "avx", "clflush", "sep", | | | "syscall", "vme", "invpcid", "tsc", | | | "fsgsbase", "xsave", "pge", "vmx", | | | "erms", "cmov", "smep", "pcid", "pat", | | | "lm", "msr", "adx", "3dnowprefetch", | | | "nx", "fxsr", "sse4.1", "pae", "sse4.2", | | | "pclmuldq", "fma", "tsc-deadline", | | | "mmx", "osxsave", "cx8", "mce", "de", | | | "rdtscp", "ht", "pse", "lahf_lm", "abm", | | | "rdseed", "popcnt", "mca", "pdpe1gb", | | | "apic", "sse", "f16c", "mpx", "invtsc", | | | "pni", "aes", "avx2", "sse2", "ss", | | | "hypervisor", "bmi1", "bmi2", "ssse3", | | | "fpu", "cx16", "pse36", "mtrr", "movbe", | | | "rdrand", "x2apic"] | | cpu_info_model | Broadwell-noTSX | | cpu_info_topology_cells | 1 | | cpu_info_topology_cores | 2 | | cpu_info_topology_sockets | 1 | | cpu_info_topology_threads | 1 | | cpu_info_vendor | Intel | | current_workload | 0 | | disk_available_least | 31 | | free_disk_gb | 34 | | free_ram_mb | 7296 | | host_ip | 192.168.100.10 | | hypervisor_hostname | controller | | hypervisor_type | QEMU | | hypervisor_version | 2003000 | | id | 1 | | local_gb | 34 | | local_gb_used | 0 | | memory_mb | 7808 | | memory_mb_used | 512 | | running_vms | 0 | | service_disabled_reason | None | | service_host | controller | | service_id | 6 | | state | up | | status | enabled | | vcpus | 2 | | vcpus_used | 0 | +---------------------------+------------------------------------------+ OpenStack Swift管理 使用VMWare软件启动提供的opensatckallinone镜像,自行检查openstack中各服务的状态,若有问题自行排查。使用swift相关命令,创建一个名叫examcontainer的容器,然后往这个容器中上传一个test.txt的文件(文件可以自行创建),上传完毕后,使用命令查看容器,将操作命令和返回结果以文本形式提交到答题框。(40)分 [root@controller ~]# swift post examcontainer [root@controller ~]# touch test.txt [root@controller ~]# swift upload examcontainer test.txt test.txt [root@controller ~]# swift list examcontainer [root@controller ~]# swift stat examcontainer Docker Docker安装 使用xserver1节点,自行配置YUM源,安装docker服务(需要用到的包为xserver1节点/root目录下的Docker.tar.gz)。安装完服务后,将registry_latest.tar上传到xserver1节点中并配置为私有仓库。要求启动registry容器时,将内部保存文件的目录映射到外部的/opt/registry目录,将内部的5000端口映射到外部5000端口。依次将启动registry容器的命令及返回结果、执行docker info命令的返回结果以文本形式提交到答题框。 [root@xserver1 ~]# tar xfv Docker.tar.gz [root@xserver1 ~]# vi /etc/yum.repos.d/local.repo # 添加 [docker] name=docker baseurl=file:///root/Docker gpgcheck=0 enabled=1 [root@xserver1 ~]# yum repolist [root@xserver1 ~]# yum install -y docker-ce [root@xserver1 ~]# systemctl daemon-reload [root@xserver1 ~]# systemctl start docker [root@xserver1 ~]# ./image.sh [root@xserver1 ~]# vi /etc/docker/daemon.json # 添加 { "insecure-registries": ["192.168.100.11:5000"] } [root@xserver1 ~]# systemctl restart docker [root@xserver1 ~]# docker run -d --restart=always -v /opt/registry/:/var/lib/registry -p 5000:5000 registry:latest 950319053db0f90eef33b33ce3bc76a93d3b6cf4b17c27b532d23e8aa9ef7bb9 [root@xserver1 ~]# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 950319053db0 registry:latest "/entrypoint.sh /etc…" 19 seconds ago Up 18 seconds 0.0.0.0:5000->5000/tcp xenodochial_johnson [root@xserver1 ~]# docker info # 答题框 [root@xserver1 ~]# docker info Containers: 1 Running: 0 Paused: 0 Stopped: 1 Images: 11 Server Version: 18.09.6 Storage Driver: devicemapper Pool Name: docker-253:0-67486317-pool Pool Blocksize: 65.54kB Base Device Size: 10.74GB Backing Filesystem: xfs Udev Sync Supported: true Data file: /dev/loop1 Metadata file: /dev/loop2 Data loop file: /var/lib/docker/devicemapper/devicemapper/data Metadata loop file: /var/lib/docker/devicemapper/devicemapper/metadata Data Space Used: 1.339GB Data Space Total: 107.4GB Data Space Available: 26.1GB Metadata Space Used: 2.077MB Metadata Space Total: 2.147GB Metadata Space Available: 2.145GB Thin Pool Minimum Free Space: 10.74GB Deferred Removal Enabled: true Deferred Deletion Enabled: true Deferred Deleted Device Count: 0 Library Version: 1.02.107-RHEL7 (2015-10-14) Logging Driver: json-file Cgroup Driver: cgroupfs Plugins: Volume: local Network: bridge host macvlan null overlay Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog Swarm: inactive Runtimes: runc Default Runtime: runc Init Binary: docker-init containerd version: b34a5c8af56e510852c35414db4c1f4fa6172339 runc version: 3e425f80a8c931f88e6d94a8c831b9d5aa481657 init version: fec3683 Security Options: seccomp Profile: default Kernel Version: 3.10.0-327.el7.x86_64 Operating System: CentOS Linux 7 (Core) OSType: linux Architecture: x86_64 CPUs: 2 Total Memory: 3.688GiB Name: xserver1 ID: VXSJ:7YFV:GWBV:2E3E:LAIM:EQ36:MRCD:Q6BG:IRBS:HJXU:K4ZD:E377 Docker Root Dir: /var/lib/docker Debug Mode (client): false Debug Mode (server): false Registry: https://index.docker.io/v1/ Labels: Experimental: false Insecure Registries: 127.0.0.0/8 Live Restore Enabled: false Product License: Community Engine WARNING: bridge-nf-call-iptables is disabled WARNING: bridge-nf-call-ip6tables is disabled WARNING: the devicemapper storage-driver is deprecated, and will be removed in a future release. WARNING: devicemapper: usage of loopback devices is strongly discouraged for production use. Use `--storage-opt dm.thinpooldev` to specify a custom block storage device. [root@xserver1 ~]# docker run -d -v /opt/registry:/var/lib/registry -p 5000:5000 registry:latest b45c91876af54542dbc15706b7cb037e5b716068f7d33bba42df1f874d3d6bbf Docker运维 使用xserver1节点,上传nginx_latest.tar到xserver1节点中,然后将该镜像打标签,上传至私有仓库。使用xserver2节点,自行安装docker服务,配置xserver2节点使用xserver1的私有仓库,配置完毕后,在xserver2节点拉取nginx_latest.tar镜像。最后将在xserver2上执行docker images命令返回的结果以文本形式提交到答题框。 [root@xserver1 ~]# cd images [root@xserver1 images]# docker load -i nginx_latest.tar Loaded image: nginx:latest [root@xserver1 images]# docker tag nginx:latest 192.168.100.11:5000/nginx:latest [root@xserver1 images]# docker push 192.168.100.11:5000/nginx:latest The push refers to repository [192.168.100.11:5000/nginx] a89b8f05da3a: Pushed 6eaad811af02: Pushed b67d19e65ef6: Pushed latest: digest: sha256:f56b43e9913cef097f246d65119df4eda1d61670f7f2ab720831a01f66f6ff9c size: 948 [root@xserver1 ~]# cp -r Docker /opt/ [root@xserver2 ~]# vi /etc/yum.repos.d/ftp.repo # 添加 [docker] name=docker baseurl=ftp://xserver1/Docker gpgcheck=0 enabled=1 [root@xserver2 ~]# yum repolist [root@xserver2 ~]# yum install -y docker-ce [root@xserver2 ~]#systemctl daemon-reload [root@xserver2 ~]# systemctl start docker [root@xserver2 ~]# vi /etc/docker/daemon.json # 添加 { "insecure-registries": ["192.168.100.11:5000"] } [root@xserver2 ~]# systemctl restart docker [root@xserver2 ~]# docker pull 192.168.100.11:5000/nginx:latest [root@xserver2 ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE 192.168.100.11:5000/nginx latest 540a289bab6c 2 years ago 126MB Docker管理 假设当前存在docker镜像tomcat:latest,现在将tomcat镜像导出,导出名称为tomcat_images.tar,放在/media目录下,将以上操作命令填入答题框。 [root@xserver2 ~]# docker tag 192.168.100.11:5000/nginx:latest tomcat:latest [root@xserver2 ~]# docker save tomcat:latest > /media/tomcat_images.tar Dockerfile编写 使用xserver1节点,新建httpd目录,然后编写Dockerfile文件,要求如下:1)使用centos:latest镜像作为基础镜像;2)作者为xiandian;3)Dockerfile要求删除镜像的yum源,使用当前系统的local.repo源文件;4)安装http服务;5)暴露80端口。编写完毕后,构建的镜像名字叫httpd:v1.0的镜像。完成后将Dockerfile文件和镜像列表信息以文本形式提交到答题框。 [root@xserver1 ~]# mkdir httpd [root@xserver1 ~]# cd httpd/ [root@xserver1 httpd]# vi Dockerfile FROM centos:latest MAINTAINER xiandian RUN rm -f /etc/yum.repos.d/* COPY local.repo /etc/yum.repos.d/ RUN yum install -y httpd EXPOSE 80 [root@xserver1 httpd]# cat local.repo [centos] name=centos baseurl=ftp://192.168.100.11/centos gpgcheck=0 enabled=1 [root@xserver1 httpd]# docker build -t httpd:v1.0 . [root@xserver1 httpd]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE httpd v1 4ff5ef091914 19 seconds ago 220MB Dockerfile 编写 使用 xserver1 节点,新建目录 centos-jdk,将提供的 jdk-8u141-linux-x64.tar.gz 复制新建的目录,然后编辑 Dockerfile 文件,文件要求如下: 1.使用 centos:latest 基础镜像; 2.指定作者为 xiandian; 3.新建文件夹/usr/local/java 用于存放 jdk 文件; 4.将 JDK 文件复制到镜像内创建的目录并自动解压; 5.创建软连接:ln -s /usr/local/java/jdk1.8.0_141 /usr/local/java/jdk; 6.设置环境变量如下 ENV JAVA_HOME /usr/local/java/jdk ENV JRE_HOME ${JAVA_HOME}/jre ENV CLASSPATH .:${JAVA_HOME}/lib:${JRE_HOME}/lib ENV PATH ${JAVA_HOME}/bin:$PATH 编写完毕后,构建名为 centos-jdk 的镜像,构建成功后,查看镜像列表。 最后将 Dockerfile 的内容、构建镜像的操作命令、查看镜像列表的命令和返回的(简要)写到下方。 [root@xserver1 ~]# mkdir centos-jdk [root@xserver1 ~]# cd centos-jdk/ [root@xserver1 centos-jdk]# cat Dockerfile FROM centos:latest MAINTAINER xiandian WORKDIR /usr/local/java ADD jdk-8u141-linux-x64.tar.gz /usr/local/java RUN ln -s /usr/local/java/jdk1.8.0_141 /usr/local/java/jdk ENV JAVA_HOME /usr/local/java/jdk ENV JRE_HOME ${JAVA_HOME}/jre ENV CLASSPATH .:${JAVA_HOME}/lib:${JRE_HOME}/lib ENV PATH ${JAVA_HOME}/bin:$PATH [root@xserver1 centos-jdk]# cp /root/jdk/jdk-8u141-linux-x64.tar.gz . [root@xserver1 centos-jdk]# docker build -t centos-jdk:v1 . Sending build context to Docker daemon 185.5MB Step 1/9 : FROM centos:latest ---> 0f3e07c0138f Step 2/9 : MAINTAINER xiandian ---> Using cache ---> 380ab4775829 Step 3/9 : WORKDIR /usr/local/java ---> Running in 3d042489bc79 Removing intermediate container 3d042489bc79 ---> 0ca117e514c2 Step 4/9 : ADD jdk-8u141-linux-x64.tar.gz /usr/local/java ---> a46b588b978d Step 5/9 : RUN ln -s /usr/local/java/jdk1.8.0_141 /usr/local/java/jdk ---> Running in 5a6643a9a5cb Removing intermediate container 5a6643a9a5cb ---> 0bcbb2fbe73f Step 6/9 : ENV JAVA_HOME /usr/local/java/jdk ---> Running in 7522f805f7d4 Removing intermediate container 7522f805f7d4 ---> 3d366a42f998 Step 7/9 : ENV JRE_HOME ${JAVA_HOME}/jre ---> Running in b550575dc17e Removing intermediate container b550575dc17e ---> e0df108c1aed Step 8/9 : ENV CLASSPATH .:${JAVA_HOME}/lib:${JRE_HOME}/lib ---> Running in 1b439c9f4e25 Removing intermediate container 1b439c9f4e25 ---> bb89ab740e4e Step 9/9 : ENV PATH ${JAVA_HOME}/bin:$PATH ---> Running in d18c59ac844d Removing intermediate container d18c59ac844d ---> 59d4683996a7 Successfully built 59d4683996a7 Successfully tagged centos-jdk:v1 [root@xserver1 centos-jdk]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE centos-jdk v1 3ca44b341427 7 seconds ago 596MB 部署Swarm集群 使用xserver1、xserver2节点,自行配置好网络,安装好docker-ce。部署Swarm集群,并安装Portainer图形化管理工具,部署完成后,使用浏览器登录ip:9000界面,进入Swarm控制台。将curl swarm ip:9000返回的结果以文本形式提交到答题框。 [root@xserver1 ~]# docker swarm init --advertise-addr 192.168.100.11 Swarm initialized: current node (z9kmpvwdd1mcytddlr7qxfqz3) is now a manager. To add a worker to this swarm, run the following command: docker swarm join --token SWMTKN-1-31hn156p86fr6eo720rq9mqafckpw1who0i39dxv9m3tbpjd0l-86zun6fgtb3b56iguf91luoge 192.168.100.11:2377 To add a manager to this swarm, run 'docker swarm join-token manager' and follow the instructions. [root@xserver2 ~]# docker swarm join --token SWMTKN-1-31hn156p86fr6eo720rq9mqafckpw1who0i39dxv9m3tbpjd0l-86zun6fgtb3b56iguf91luoge 192.168.100.11:2377 This node joined a swarm as a worker. [root@xserver1 centos-jdk]# docker node ls ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS ENGINE VERSION 80cisraj17qq1tuawca29a8b1 * xserver1 Ready Active Leader 18.09.6 dsot82834vazufdo3x9y79lgj xserver2 Ready Active 18.09.6 [root@xserver1 ~]# docker tag 4cda95efb0e4 portainer/portainer:latest [root@xserver1 ~]# docker service create \ --name portainer \ --publish 9000:9000 \ --replicas=1 \ --constraint 'node.role == manager' \ --mount type=bind,src=//var/run/docker.sock,dst=/var/run/docker.sock \ --mount type=volume,src=portainer_data,dst=/data \ portainer/portainer -H unix:///var/run/docker.sock # 访问浏览器 访问IP:9000,设置密码
2021年12月04日
265 阅读
0 评论
0 点赞
2021-10-28
Nginx浏览目录
Nginx浏览目录 添加 ngx-fancyindex 模块 # 检查当前 nginx 版本 [root@ftp-server ~]# nginx -v nginx version: nginx/1.20.1 # 选择相应的版本 http://nginx.org/download/ wget http://nginx.org/download/nginx-1.20.1.tar.gz tar -xf nginx-1.20.1.tar.gz cd nginx-1.20.1 # 下载第三方模块 wget https://github.com/aperezdc/ngx-fancyindex/releases/download/v0.5.1/ngx-fancyindex-0.5.1.tar.xz tar -xf ngx-fancyindex-0.5.1.tar.xz # 安装编译工具 yum install -y gcc gcc-c++ pcre pcre-devel zlib zlib-devel openssl openssl-devel # 查询nginx 参数 [root@ftp-server nginx-1.20.1]# nginx -V nginx version: nginx/1.20.1 built by gcc 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC) built with OpenSSL 1.0.2k-fips 26 Jan 2017 TLS SNI support enabled configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-file-aio --with-threads --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module # 生成makefile文件 ./configure --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-file-aio --with-threads --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --add-module=./ngx-fancyindex-0.5.1 # 编译&安装 make && make install # 查询模块 [root@ftp-server nginx-1.20.1]# nginx -V nginx version: nginx/1.20.1 built by gcc 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC) built with OpenSSL 1.0.2k-fips 26 Jan 2017 TLS SNI support enabled configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-file-aio --with-threads --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --add-module=./ngx-fancyindex-0.5.1 修改 nginx 配置文件 [root@ftp-server ~]# more /etc/nginx/nginx.conf worker_processes 1; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; server { listen 80; server_name localhost; index index.html index.htm; charset utf-8,gbk; location / { root /data/downloads; fancyindex on; fancyindex_exact_size off; fancyindex_name_length 200; fancyindex_localtime on; fancyindex_time_format "%Y-%b-%d %H:%M"; fancyindex_ignore "fancyindex"; fancyindex_header "/fancyindex/header.html"; fancyindex_footer "/fancyindex/footer.html"; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } } 添加主题 仓库地址 https://github.com/TheInsomniac/Nginx-Fancyindex-Theme https://github.com/Naereen/Nginx-Fancyindex-Theme https://github.com/fraoustin/Nginx-Fancyindex-Theme https://github.com/alehaa/nginx-fancyindex-flat-theme # 下载相关代码放置 网页目录 [root@ftp-server ~]# tree -L 1 /data/downloads/fancyindex /data/downloads/fancyindex ├── clipboard.min.js ├── dialog-polyfill.css ├── dialog-polyfill.js ├── fancyindex.css ├── fancyindex.js ├── font ├── footer.html ├── header.html ├── images ├── material-icons.css ├── mdl ├── README.md └── roboto.css 效果 参考 Nginx 目录浏览基础与进阶
2021年10月28日
313 阅读
0 评论
0 点赞
2021-10-21
振兴杯(云计算)
比赛内容:华为云及网络搭建,小组赛。我是做华为云的部分,后面我会讲讲云的内容。 {card-default label="试题一" width=""} 创建 两台ECS 分布于 北京四&上海一 购买 VPN虚拟网络,连接上海一&北京四的VPC ECS1 ping ECS2 可以通信 {/card-default} {card-default label="试题二" width=""} 购买 弹性公网IP、弹性负载均衡、CCE、RDB 负载均衡绑定弹性公网IP,暴露7777端口,代理CCE中的云容器实例 WordPress,WordPress 数据库使用 RDB。暴露8888端口,在CCE部署一个云容器实例,可以通过公网IP的8888端口访问 {/card-default} {card-default label="试题三" width=""} {/card-default} 总结 对公有云产品的使用不够熟悉,很多产品没有实际体验过,比赛中的VPN不知如何使用,CCE的容器云的操作对接负载均衡存在问题,在云开发部分也有较多失误。对考试的时间把握的不好,没有整体性,做的很乱。
2021年10月21日
214 阅读
0 评论
0 点赞
2021-10-21
FusionCompute8.0 体验
引言 私有云平台 OpenStack、虚拟化 ESXI 都部署体验过。现在迷茫不知道干嘛,前几天用了华为云产品,在云盘找到了 FusionCompute 的软件包。忍不住想部署一下,体验一下厂商的产品和开源的区别,也想了解一下华为云的知识。 虚拟机安装方式: VMware CNA (8G 4C 100G) VMR (8G 4c 100G) VMware (Ubuntu KVM(16G 6C 200G)) CNA VMR 服务器安装: CNA VMR 浅谈 FunsionCompute8.0 的套件,华为云官网是需要权限才能使用(客户&合作伙伴)。显然,我啥也不是。只好在B站找了些的视频看了一下,没有找到相关视频。只有6.X版本的讲解,在一下老师的视频中。我了解到,不能直接在VMware中部署。有两种方式可以正常使用,就是我上面写的方式。在虚拟化(KVM)中部署CNA & VMR,在裸机部署。在VMware中直接装CNA、VMR配置给大点可以安装,但是VMR中加不进CNA。只能体验安装,不能使用FC平台是不能接受的。 后面,我会基于Ubuntu 的 KVM 环境,再次尝试安装。也会尝试在裸机中安装。后面在来讲讲安装的过程吧,这次就简单聊聊 FC。
2021年10月21日
573 阅读
0 评论
0 点赞
2021-10-07
CentOS7 Zabbix5.0 分布安装
zabbix5.0 分布安装 环境规划 主机名 IP 环境 zabbix-server 10.35.172.76 zabbix-server、zabbix-agent zabbix-web 10.35.172.77 nginx、php7.2 zabbix-db 10.35.172.78 mysql5.7 zabbix-db # 安装 MySQL5.7 Yum 源 rpm -ivh http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm # 检查 Yum 源 ls /etc/yum.repos.d/ yum repolist enabled | grep mysql # 安装 & 启动 MySQL yum install mysql-community-server -y systemctl start mysqld && systemctl enable mysqld # 修改root密码, 创建zabbix数据库及用户并授权,刷新权限 grep 'temporary password' /var/log/mysqld.log mysql -uroot -pds,GLkvre7fG mysql> ALTER USER root@localhost IDENTIFIED BY 'P@ssw0rd'; mysql> create database zabbix character set utf8 collate utf8_bin; mysql> create user 'zabbix'@'%' identified by 'P@ssw0rd'; mysql> grant all privileges on zabbix.* to 'zabbix'@'%'; mysql> flush privileges; # 导入数据(create.sql.gz由zabbix-server主机拷贝) zcat create.sql.gz | mysql -uzabbix -pP@ssw0rd zabbix zabbix-web # 安装 PHP7 Yum 源 rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm # 安装 php7.2 及相关插件 yum install php72w-fpm php72w-gd.x86_64 php72w-bcmath.x86_64 php72w-xml.x86_64 php72w-mbstring.x86_64 php72w-ldap.x86_64 php72w-mysqlnd.x86_64 -y # 检查 php版本 php-fpm -v # 安装 Nginx yum install nginx -y # 生成 Nginx 模板文件 grep -Ev "#|^$" /etc/nginx/nginx.conf.default > /etc/nginx/nginx.conf # cp php 相关片段 vim /etc/nginx/nginx.conf.default #location ~ \.php$ { # root html; # fastcgi_pass 127.0.0.1:9000; # fastcgi_index index.php; # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; # include fastcgi_params; #} # 修改配置文件 vim /etc/nginx/nginx.conf # 修改 root 目录 index # 删除 error 模块 # 添加 php相关片段 # 创建 Nginx 网页目录 mkdir /html # 检查 Nginx 语法 nginx -t # 启动 Nginx & php systemctl start nginx && systemctl enable nginx systemctl start php-fpm && systemctl enable php-fpm # 下载 Zabbix 软件包 wget https://cdn.zabbix.com/zabbix/sources/stable/5.0/zabbix-5.0.16.tar.gz # 解压 & cp 前端文件 到 网页目录 tar xf zabbix-5.0.16.tar.gz cp -a /root/zabbix-5.0.16/ui/* /html # 目录授权 chown -R nginx:nginx /html # 创建 session 目录,并授权 mkdir /var/lib/php/session chown -R nginx:nginx /var/lib/php/session # 修改 php.ini 配置文件 vim /etc/php.ini # max_execution_time = 300 # max_input_time = 300 # post_max_size = 16M # date.timezone = Asia/Shanghai # 重启生效配置文件 systemctl restart php-fpm # 上传字体文件,并替换 cd /html/assets/fonts mv simhei.ttf DejaVuSans.ttf zabbix-server # 安装 Zabbix Yum源 rpm -ivh https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm # 替换 Yum仓库 sed -i 's#http://repo.zabbix.com#https://mirrors.tuna.tsinghua.edu.cn/zabbix#g' /etc/yum.repos.d/zabbix.repo # 安装 zabbix-server yum install zabbix-server-mysql -y # 将 create.sql.gz 拷贝至 zabbix-db scp /usr/share/doc/zabbix-server-mysql-5.0.16/create.sql.gz 10.35.172.78:/root # 配置 zabbix-server 中的 DB vim /etc/zabbix/zabbix_server.conf # DBHost=localhost # DBName=zabbix # DBUser=zabbix # DBPassword=123456 # 启动 Zabbix-server systemctl start zabbix-server && systemctl enable zabbix-server # 安装 net-tools,检查 服务端口 yum install -y net-tools netstat -lntp # 安装 & 启动 zabbix-agent yum install -y zabbix-agent systemctl start zabbix-agent && systemctl enable zabbix-agent 访问 10.35.172.77 配置使用 zabix
2021年10月07日
208 阅读
0 评论
0 点赞
1
...
5
6
7
...
16