首页
归档
时光轴
推荐
Cloud
图床
导航
Search
1
Deploy OpenStack offline based on Kolla
737 阅读
2
openstact 基础环境安装 (手动版)
686 阅读
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
图床
导航
搜索到
28
篇与
的结果
2023-05-06
准备 kolla 离线部署包
分析需要的文件 RPM包 容器镜像 pip 包 流程 1、配置完yum源,设置开启缓存。手动部署完,制作 repo 源 2、手动部署完,将所有容器打包 3、手动部署完,统计 python模块包 写到 requirements.txt,下载收集并编写安装脚本。 容器镜像 全部导出 docker save `docker images --format "{{.Repository}}:{{.Tag}}"` | gzip > kolla_centos_train_min.tar.gz 导入 docker load -i kolla_centos_train_min.tar.gz rpm 软件包 [root@kolla ~]# mkdir /repo [root@kolla ~]# cat /etc/yum.conf [main] cachedir=/repo keepcache=1 ... [root@kolla ~]# yum install -y createrepo [root@kolla ~]# cd /repo [root@kolla repo]# mkdir -p kolla_centos_train_rpm/Packages [root@kolla repo]# cp -ra */packages/* kolla_centos_train_rpm/Packages [root@kolla repo]# cd kolla_centos_train_rpm [root@kolla kolla_centos_train_rpm]# createrepo ./ [root@kolla kolla_centos_train_rpm]# ls Packages repodata [root@kolla kolla_centos_train_rpm]# cd /repo [root@kolla repo]# tar cfz kolla_centos_train_rpm.tar.gz kolla_centos_train_rpm pip 依赖包 [root@kolla kolla_centos_train_whl]# cat requirements.txt setuptools==22.0.5 pip==20.3.4 wheel kolla-ansible==9.1.0 [root@kolla kolla_centos_train_whl]# mkdir packages [root@kolla kolla_centos_train_whl]# pip download -d packages -r requirements.txt [root@kolla kolla_centos_train_whl]# cat install.sh #!/bin/bash pip install --no-index --find-links=./packages/ setuptools==22.0.5 pip install --no-index --find-links=./packages/ pip==20.3.4 pip install --no-index --find-links=./packages/ wheel pip install --no-index --find-links=./packages/ kolla-ansible==9.1.0 --ignore-installed PyYAML [root@kolla ~]# tar cfz kolla_centos_train_whl.tar.gz kolla_centos_train_whl/
2023年05月06日
328 阅读
0 评论
0 点赞
2022-11-21
Jenkins 迁移
Jenkins 迁移 [root@jenkins ~]# rpm -ql jenkins /etc/init.d/jenkins /etc/logrotate.d/jenkins /etc/sysconfig/jenkins /usr/bin/jenkins /usr/lib/systemd/system/jenkins.service /usr/sbin/rcjenkins /usr/share/java/jenkins.war /usr/share/jenkins /usr/share/jenkins/migrate /var/cache/jenkins /var/lib/jenkins /var/log/jenkins 备份 1、停止 jenkins [root@jenkins ~]# systemctl stop jenkins [root@jenkins ~]# ps -ef | grep jenkins root 1818 1679 0 10:40 pts/0 00:00:00 grep --color=auto jenkins 2、备份 [root@jenkins ~]# grep ^JENKINS_HOME /etc/sysconfig/jenkins JENKINS_HOME="/var/lib/jenkins" [root@jenkins ~]# cd /var/lib [root@jenkins lib]# tar cfz jenkins_home.tar.gz jenkins [root@jenkins lib]# du -sh jenkins_home.tar.gz 182M jenkins_home.tar.gz [root@jenkins lib]# mv jenkins_home.tar.gz /root/ [root@jenkins ~]# cp -a /usr/lib/systemd/system/jenkins.service . [root@jenkins ~]# cp -a /etc/sysconfig/jenkins . [root@jenkins ~]# tar cfz jenkins_backup.tar.gz jenkins* [root@jenkins ~]# ll total 553540 -rw-------. 1 root root 1456 Nov 8 09:06 anaconda-ks.cfg -rwxr-xr-x. 1 root root 1012 Nov 8 09:14 init.sh -rw-------. 1 root root 4034 Nov 8 09:19 jenkins -rw-r--r--. 1 root root 93270402 Nov 2 07:55 jenkins-2.376-1.1.noarch.rpm -rw-r--r-- 1 root root 283331868 Nov 21 10:49 jenkins_backup.tar.gz -rw-r--r-- 1 root root 190196115 Nov 21 10:41 jenkins_home.tar.gz -rw-r--r--. 1 root root 5627 Nov 8 13:39 jenkins.service [root@jenkins ~]# du -sh jenkins_backup.tar.gz 271M jenkins_backup.tar.gz [root@jenkins ~]# sz jenkins_backup.tar.gz rz zmodem trl+C ȡ 正在传输 jenkins_backup.tar.gz... 100% 276691 KB 17293 KB/ 00:00:16 0 还原 1、java 环境 [root@thinkpad-e490 ~]# yum install -y java-11-openjdk java-11-openjdk-devel [root@thinkpad-e490 ~]# java --version openjdk 11.0.17 2022-10-18 LTS OpenJDK Runtime Environment (Red_Hat-11.0.17.0.8-2.el7_9) (build 11.0.17+8-LTS) OpenJDK 64-Bit Server VM (Red_Hat-11.0.17.0.8-2.el7_9) (build 11.0.17+8-LTS, mixed mode, sharing) 2、还原 [root@thinkpad-e490 ~]# rz rz waiting to receive. zmodem trl+C ȡ 正在传输 jenkins_backup.tar.gz... 100% 276691 KB 39527 KB/ 00:00:07 0 [root@thinkpad-e490 ~]# tar xfz jenkins_backup.tar.gz [root@thinkpad-e490 ~]# ll total 553536 -rw-------. 1 root root 1542 Nov 16 17:47 anaconda-ks.cfg -rw------- 1 root root 4034 Nov 8 09:19 jenkins -rw-r--r-- 1 root root 93270402 Nov 2 07:55 jenkins-2.376-1.1.noarch.rpm -rw-r--r-- 1 root root 283331868 Nov 21 10:49 jenkins_backup.tar.gz -rw-r--r-- 1 root root 190196115 Nov 21 10:41 jenkins_home.tar.gz -rw-r--r-- 1 root root 5627 Nov 8 13:39 jenkins.service [root@thinkpad-e490 ~]# rpm -ivh jenkins-2.376-1.1.noarch.rpm warning: jenkins-2.376-1.1.noarch.rpm: Header V4 RSA/SHA512 Signature, key ID 45f2c3d5: NOKEY Preparing... ################################# [100%] Updating / installing... 1:jenkins-2.376-1.1 ################################# [100%] [root@thinkpad-e490 ~]# mv jenkins /etc/sysconfig/jenkins mv: overwrite ‘/etc/sysconfig/jenkins’? y [root@thinkpad-e490 ~]# mv jenkins.service /usr/lib/systemd/system/jenkins.service mv: overwrite ‘/usr/lib/systemd/system/jenkins.service’? y [root@thinkpad-e490 ~]# tar xfz jenkins_home.tar.gz -C /var/lib/ 3、启动 [root@thinkpad-e490 ~]# systemctl start jenkins [root@thinkpad-e490 ~]# systemctl status jenkins ● jenkins.service - Jenkins Continuous Integration Server Loaded: loaded (/usr/lib/systemd/system/jenkins.service; disabled; vendor preset: disabled) Active: active (running) since Mon 2022-11-21 10:57:43 CST; 1s ago Main PID: 1861 (java) CGroup: /system.slice/jenkins.service └─1861 /usr/bin/java -Djava.awt.headless=true -jar /usr/share/java/jenkins.war --webroot=%C/jenkins/war ... Nov 21 10:57:42 thinkpad-e490 jenkins[1861]: 2022-11-21 02:57:42.968+0000 [id=34] INFO hudson.sl...t sdk Nov 21 10:57:42 thinkpad-e490 jenkins[1861]: 2022-11-21 02:57:42.980+0000 [id=32] INFO jenkins.I...oaded Nov 21 10:57:42 thinkpad-e490 jenkins[1861]: 2022-11-21 02:57:42.982+0000 [id=32] INFO jenkins.I...apted Nov 21 10:57:43 thinkpad-e490 jenkins[1861]: 2022-11-21 02:57:43.019+0000 [id=33] INFO jenkins.I... jobs Nov 21 10:57:43 thinkpad-e490 jenkins[1861]: 2022-11-21 02:57:43.027+0000 [id=46] INFO jenkins.I...dated Nov 21 10:57:43 thinkpad-e490 jenkins[1861]: 2022-11-21 02:57:43.059+0000 [id=64] INFO hudson.ut...erver Nov 21 10:57:43 thinkpad-e490 jenkins[1861]: 2022-11-21 02:57:43.227+0000 [id=33] INFO o.j.main....46087 Nov 21 10:57:43 thinkpad-e490 jenkins[1861]: 2022-11-21 02:57:43.227+0000 [id=43] INFO jenkins.I...ation Nov 21 10:57:43 thinkpad-e490 jenkins[1861]: 2022-11-21 02:57:43.283+0000 [id=24] INFO hudson.li...nning Nov 21 10:57:43 thinkpad-e490 systemd[1]: Started Jenkins Continuous Integration Server. Hint: Some lines were ellipsized, use -l to show in full. [root@thinkpad-e490 ~]# ps -ef | grep jenkins root 1861 1 99 10:57 ? 00:00:44 /usr/bin/java -Djava.awt.headless=true -jar /usr/share/java/jenkins.war --webroot=%C/jenkins/war --httpPort=8080 root 2025 1539 0 10:57 pts/0 00:00:00 grep --color=auto jenkins [root@thinkpad-e490 ~]# free -h total used free shared buff/cache available Mem: 7.5G 896M 5.2G 9.4M 1.4G 6.4G Swap: 7.8G 0B 7.8G 4、访问
2022年11月21日
184 阅读
0 评论
0 点赞
2022-09-08
Typecho 1.2.0 部署
Typecho 1.2.0 部署 {bilibili bvid="BV15e411u7gH" page=""/} 环境 CentOS7.9 Nginx/1.20.1 PHP 7.2.34 mysql-5.7.37 初始化系统 curl -O file.youto.club/Script/init.sh sh init.sh blog [root@blog nginx]# cat /script/init.sh #!/usr/bin/bash echo "=-=-=- Action -=-=-=" hostnamectl set-hostname $1 echo "# ==> Hostname: " `hostname` systemctl stop firewalld && systemctl disable firewalld >/dev/null 2>&1 setenforce 0 >/dev/null 2>&1 sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config echo "# ==> Stop Firewalld && Selinux" mkdir /etc/yum.repos.d/bak -p mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/bak curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo >/dev/null 2>&1 curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo >/dev/null 2>&1 yum repolist | grep repolist echo "# ==>repo" yum install -y lrzsz tree wget vim net-tools unzip bash-completion git >/dev/null 2>&1 sed -i "s/\#UseDNS no/UseDNS yes/g" /etc/ssh/sshd_config echo "# ==> SSH " echo "=-=-=- Done -=-=-=" 准备软件包 mysql-5.7.37-1.el7.x86_64.rpm.tar nginx-1.20.1.tar.gz typecho.zip mkdir /{repo,software,script} # MySQl wget http://file.youto.club/Repo/mysql-5.7.37-1.el7.x86_64.rpm.tar tar xf mysql-5.7.37-1.el7.x86_64.rpm.tar -c /repo ls /repo/mysql57_2009_repo/ vim /etc/yum.repos.d/mysql_local.repo yum repolist # PHP72 yum install -y http://rpms.remirepo.net/enterprise/remi-release-7.rpm yum install -y yum-utils yum-config-manager --enable remi-php72 # typecho wget https://github.com/typecho/typecho/releases/latest/download/typecho.zip mv typecho.zip /software/ [root@blog nginx]# cat /etc/yum.repos.d/mysql_local.repo [mysql57] name=mysql57 baseurl=file:///repo/mysql57_2009_repo/ gpgcheck=0 enabled=1 MySQL yum install -y mysql-server systemctl enable mysqld systemctl start mysqld grep pass /var/log/mysqld.log mysql -uroot -p [root@blog nginx]# mysql -uroot -p mysql> alter user user() identified by 'Admin@123'; Query OK, 0 rows affected (0.00 sec) mysql> create database typecho; Query OK, 1 row affected (0.00 sec) mysql> GRANT ALL ON typecho.* TO 'typecho'@'localhost' IDENTIFIED BY 'Abc@1234'; Query OK, 0 rows affected, 1 warning (0.00 sec) PHP yum install -y php72 php72 -v yum install -y php72-php-fpm php72-php-mbstring php72-php-mysqlnd systemctl enable php72-php-fpm.service systemctl start php72-php-fpm.service netstat -lntp rpm -ql php72-php-fpm vim /etc/opt/remi/php72/php-fpm.d/www.conf [root@blog nginx]# grep nginx /etc/opt/remi/php72/php-fpm.d/www.conf user = nginx group = nginx Nginx yum install -y nginx wget https://nginx.org/download/nginx-1.20.1.tar.gz mkdir /html unzip /software/typecho.zip cd /etc/nginx/ grep -Ev "#|^$" nginx.conf.default > nginx.conf vim nginx.conf mkdir -p /var/log/blog chown -R nginx.nginx /var/log/blog nginx -t chown -R nginx.nginx /html/ systemctl start nginx # cat /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; root /html; index index.html index.htm index.php; if (!-e $request_filename) { rewrite ^(.*)$ /index.php$1 last; } location ~ .*\.php(\/.*)*$ { include fastcgi.conf; fastcgi_pass 127.0.0.1:9000; } access_log /html/access.log combined; } } 访问
2022年09月08日
640 阅读
0 评论
0 点赞
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 点赞
1
2
3
...
6