In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
1. Make a Nginx image based on centOS6 (single service)
11. Start and enter the container
[root@docker03] # docker run-it-p 80:80 centos:6.9 / bin/bash [root@9dac33fe6bda /] #
1.2 change the Yum source and epel source of the container system
[root@9dac33fe6bda /] # curl-o / etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo% Total% Received% Xferd Average Speed Time Current Dload Upload Total Spent Left Speed100 2523 2523 00 17512 0 -:: :-- 17643 [root@9dac33fe6bda /] # curl-o / etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo% Total% Received% Xferd Average Speed Time Current Dload Upload Total Spent Left Speed100 664 100 664 00 3179 0--:-3177
1.3 install the Nginx service
[root@9dac33fe6bda /] # yum install-y nginx
1.4 start nginx
[root@9dac33fe6bda /] # nginx
1.5 Test
1.6 submit the image
[root@docker03 ~] # docker commit 9dac33fe6bdasha256:b3b5ec6779bd43731aa3e1639811d1583a4404cb2296dab75a4f8c7e41d62b6a [root@docker03 ~] # docker commit 9dac33fe6bda docker_centos6.9_nginx:v1sha256:f954a629873f40f5b70676cc2618c4766b9ef161e4e46c38b89327b613662f4f [root@docker03 ~] # docker imagesREPOSITORY TAG IMAGE ID CREATED SIZEdocker_centos6.9_nginx v1 f954a629873f 7 seconds ago 446MB
1.7 Test mirroring function
[root@docker03 / opt] # docker run-d-p 80:80-v / opt:/usr/share/nginx/html docker_centos6.9_nginx:v1 nginx-g 'daemon off;' 085ea855e734a0aa4aacb739b6de788f03e9d288bf16719fd1ad2e94de5896d0
two。 Create a cloud image based on centOS (multi-service)
2.1 Boot and enter the container
[root@docker03 / opt] # docker run-it-p 80:80 centos:6.9 / bin/bash [root@274ca61dd89f /] #
2.2 change the Yum source and epel source of the container system
[root@274ca61dd89f /] # curl-o / etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo% Total% Received% Xferd Average Speed Time Current Dload Upload Total Spent Left Speed110 664 110664 4205 0 -:: -: -:-- 7545 [root@274ca61dd89f /] # curl-o / etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo% Total% Received% Xferd Average Speed Time Current Dload Upload Total Spent Left Speed100 2523 2523 00 25788 0 -::-61536
2.3 install nginx
[root@274ca61dd89f /] # yum install nginx-y
2.4 install the PHP service
[root@274ca61dd89f /] # yum install php-fpm php-gd php-mbstring-y
2.5 change PHP profile users and user groups
[root@274ca61dd89f /] # vi / etc/php-fpm.d/www.conf
2.6 start the PHP service
[root@274ca61dd89f /] # service php-fpm startStarting php-fpm: [OK]
2.7 change the configuration file for nginx
Add to vi / etc/nginx/conf.d/default.conf # # The default server#server {listen 80 default_server; listen [:]: 80 default_server; server_name _; root / html; index index.php index.html index.htm; # Load configuration files for the default server block. Include / etc/nginx/default.d/*.conf; location / {} location ~\ .php$ {root / html; fastcgi_pass 127.0.0.1 location 9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME / html$fastcgi_script_name; include fastcgi_params;}
2.8Create html directory and download Kedaoyun
[root@274ca61dd89f /] # mkdir / html [root@274ca61dd89f html] # cd / html [root@274ca61dd89f html] # curl-o kodexplorer4.40 http://static.kodcloud.com/update/download/kodexplorer4.40.zip[root@274ca61dd89f html] # lskodexplorer4.40
2.9 decompress Kedaoyun
[root@274ca61dd89f /] # install unzip-y [root@274ca61dd89f /] # unzip kodexplorer4.40
2.10 change the master group of the directory
[root@274ca61dd89f html] # chown-R nginx.nginx. [root@274ca61dd89f html] # ll / htmltotal 13676drwxr-xr-x 10 nginx nginx 115 Mar 21 2019 app-rw-r--r-- 1 nginx nginx 91248 Mar 21 2019 ChangeLog.mddrwxr-xr-x 3 nginx nginx 74 Mar 21 2019 configdrwxr-xr-x 7 nginx nginx 72 Mar 21 2019 data-rw-r--r-- 1 nginx nginx 118 Mar 21 2019 index.php-rw-r--r- -1 nginx nginx 13894810 Dec 13 02:38 kodexplorer4.40drwxr-xr-x 15 nginx nginx 218 Mar 21 2019 plugins-rw-r--r-- 1 nginx nginx 7718 Mar 21 2019 README.MDdrwxr-xr-x 6 nginx nginx 57 Mar 21 2019 static
2.11 test
2.12 write a startup script (tamping start command at the last start)
Vi init.shrunken daemon off;'~ Binram bashservice service-g 'daemon off;'~
2.13 generate an image
[root@docker03 / etc/nginx] # docker commit 274ca61dd89f docker_kod:v1sha256:da72ea94c8cbf9f2c21b7655b4146b0308053c3988fc2b6d165a1f6dd4cbc8de
2.14 Test Image
[root@docker03] # docker run-d-p 81:80 docker_kod:v1 / bin/bash / init.shcd5d18b69f1438426da1283160c73cbe45c2d8f73e74f5adeec0211bf14b52b7
3.docker manually creates images (based on C7) (Nginx+ssh)
3.1. Create and enter the container
[root@docker03 ~] # docker run-it-p 83:80 centos:7 [root@c919e69954a2 /] #
3.2. Change the Yum source and epel source of the container system
[root@c919e69954a2 /] # curl-o / etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo% Total% Received% Xferd Average Speed Time Current Dload Upload Total Spent Left Speed 0000000000 -:: -0curl-o / etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo100 2523 2523 00 17831 0--:-17893 [root@c919e69954a2 /] # curl-o / etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel- 7.repo% Total% Received% Xferd Average Speed Time Current Dload Upload Total Spent Left Speed100 664 100 664 00 5044 0 -:-5068
3.3. Install nginx
[root@c919e69954a2 /] # yum install nginx-y
3.4. Start the service
Note: C7 cannot start the service using systemctl in the container because the bus process is not started, and C7 starts fast because multiple processes start at the same time.
Root@docker03 ~] # ps-ef | grep busdbus 6819 10 Dec12? 00:00:03 / usr/bin/dbus-daemon-- system-- address=systemd:-- nofork-- nopidfile-- systemd-activationroot 43281 40267 0 11:09 pts/1 00:00:00 grep-- color=auto bus [root@c919e69954a2 /] # systemctl start nginxFailed to get D-Bus connection: Operation not permitted
Start the service manually
[root@c919e69954a2 /] # systemctl start nginxFailed to get D-Bus connection: Operation not permitted [root@c919e69954a2 /] # systemctl cat nginx# / usr/lib/systemd/system/ nginx.service[Unit] Description=The nginx HTTP and reverse proxy serverAfter=network.target remote-fs.target nss-lookup.target [Service] Type=forkingPIDFile=/run/nginx.pid# Nginx will fail to start if / run/nginx.pid already exists but has the wrong# SELinux context. This might happen when running `nginx-t` from the cmdline.# https://bugzilla.redhat.com/show_bug.cgi?id=1268621ExecStartPre=/usr/bin/rm-f / run/nginx.pidExecStartPre=/usr/sbin/nginx-tExecStart=/usr/sbin/nginxExecReload=/bin/kill-s HUP $MAINPIDKillSignal=SIGQUITTimeoutStopSec=5KillMode=processPrivateTmp= true [install] WantedBy=multi-user.target/usr/sbin/nginx
3.5. Install the ssh service
[root@c919e69954a2 /] # yum install openssh-server-y
3.6 start the sshd-keygen service (error because there is no key pair)
[root@c919e69954a2 /] # / usr/sbin/sshd-keygen/usr/sbin/sshd-keygen: line 10: / etc/rc.d/init.d/functions: No such file or directoryGenerating SSH2 RSA host key: / usr/sbin/sshd-keygen: line 63: success: command not foundGenerating SSH2 ECDSA host key: / usr/sbin/sshd-keygen: line 105: success: command not foundGenerating SSH2 ED25519 host key: / usr/sbin/sshd-keygen: line 126: success: command not found
3.7 query the corresponding software package in the host
[root@docker01] # rpm-qf / etc/rc.d/init.d/functionsinitscripts-9.49.46-1.el7.x86_64
3.8 install the package
[root@c919e69954a2 /] # yum install initscripts-y
3.9 check the key pair when starting the sshd-keygen service
[root@c1e50af6f42c /] # / usr/sbin/sshd-keygenGenerating SSH2 RSA host key: [OK] Generating SSH2 ECDSA host key: [OK] Generating SSH2 ED25519 host key: [OK] [root@c919e69954a2 /] # ls / etc/ssh/moduli ssh_host_ecdsa_key .pub ssh_host_ed25519_key.pub ssh_host_rsa_key.pub ssh_host_ecdsa_key ssh_host_ed25519_key ssh_host_rsa_key sshd_config
3.10 start the sshd service
[root@c919e69954a2 /] # systemctl cat sshd# / usr/lib/systemd/system/ SSH. Service [Description=OpenSSH server daemonDocumentation=man:sshd] man:sshd_config (5) After=network.target sshd-keygen.serviceWants=sshd- keygen.service [service] Type=notifyEnvironmentFile=/etc/sysconfig/sshdExecStart=/usr/sbin/sshd-D $OPTIONSExecReload=/bin/kill-HUP $MAINPIDKillMode=processRestart=on-failureRestartSec=42s [Install] WantedBy=multi-user.target [root@c919e69954a2 /] # / usr/sbin/sshd-D
3.11 set the container login password
Echo '123456' | passwd-- stdin root
3.12 connection test
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.