在centos7上用docker安装宝塔面板

 
1. [root@web01 ~]# systemctl enable docker

 

2. [root@web01 ~]# docker pull centos

 

3. [root@web01 ~]# docker images

REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
baota               1.0                 6112bf8cd2f8        2 hours ago         1.94GB
centos              latest              0f3e07c0138f        13 days ago         220MB
nginx               latest              f949e7d76d63        2 weeks ago         126MB
busybox             latest              19485c79a9bb        5 weeks ago         1.22MB
php                 5.6-fpm             3458979c7744        8 months ago        344MB

 

4. [root@web01 ~]# docker run -d -p 80:80 -p 443:443 -p 8888:8888 --name web --privileged=true centos /usr/sbin/init
fde8c437e30b14e1a61dfd95aae2ef51d3b20d16d8be168251995f7e38092d37

 

5.  [root@web01 ~]# docker ps

CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS                                                              NAMES
fde8c437e30b        centos              "/usr/sbin/init"    13 seconds ago      Up 11 seconds       0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp, 0.0.0.0:8888->8888/tcp   web

 

6. [root@web01 ~]# docker stop web

 

 

7. [root@web01 ~]# docker update --restart=always web

 

8.[root@web01 ~]# docker start web

 

 
9.[root@web01 ~]# docker exec -it web /bin/bash

 

 10. [root@fde8c437e30b /]# yum update

 

11. [root@fde8c437e30b /]# yum install -y wget && wget -O http://download.bt.cn/install/install_6.0.sh && sh install.sh

 

 

 

Congratulations! Installed successfully!

 

==================================================================
Bt-Panel: http://121.13.54.208:8888/fcb6c8b4
username: yrkayh40
password: ca3ce04c
Warning:
If you cannot access the panel, 
release the following port (8888|888|80|443|20|21) in the security group
==================================================================
Time consumed: 4 Minute!
[root@fde8c437e30b /]# 
 

12 [root@fde8c437e30b /]# systemctl start bt

 

 

13  [root@fde8c437e30b /]# systemctl enable bt
bt.service is not a native service, redirecting to systemd-sysv-install.
Executing: /usr/lib/systemd/systemd-sysv-install enable bt

14.  root@fde8c437e30b /]# /etc/rc.d/init.d/bt default

 

==================================================================
BT-Panel default info!
==================================================================
Bt-Panel-URL: http://121.13.54.208:8888/fcb6c8b4
username: yrkayh40
password: ca3ce04c
Warning:
If you cannot access the panel, 
release the following port (8888|888|80|443|20|21) in the security group
==================================================================
 
 

 

15 root@fde8c437e30b /]# yum install openssh-server

 

16.[root@fde8c437e30b /]# systemctl enable sshd

 

补充:一些常用的指令

1.统计目录的大小

[root@web01 docker]# ls -lh
总用量 256M
drwxr-xr-x. 2 root root    6 10月 14 23:49 conf
-rw-r--r--. 1 root root  15K 10月 15 17:50 epel-release-latest-7.noarch.rpm
-rw-r--r--. 1 root root 175M 10月 16 04:40 fornarina-backup-3-09-2019.7z
drwxr-xr-x. 2 root root    6 10月 15 16:51 images
drwxr-xr-x. 5 root root   40 10月 14 22:08 nginx
drwxr-xr-x. 2 root root    6 10月 14 21:30 www
 

 2 查看文件系统容量

[root@web01 /]# df -mh
文件系统                 容量  已用  可用 已用% 挂载点
devtmpfs                 899M     0  899M    0% /dev
tmpfs                    910M     0  910M    0% /dev/shm
tmpfs                    910M  9.5M  901M    2% /run
tmpfs                    910M     0  910M    0% /sys/fs/cgroup
/dev/mapper/centos-root   50G  7.5G   43G   15% /
/dev/sda1               1014M  149M  866M   15% /boot
/dev/mapper/centos-home   27G   33M   27G    1% /home
tmpfs                    182M     0  182M    0% /run/user/0
overlay                   50G  7.5G   43G   15% /var/lib/docker/overlay2/2e821c708514585fb6e1ed141fc25a7b62f9b804898ab113749d49f8605b48ac/merged

 3.修改yum 源为国内源

[root@web01 yum.repos.d]# cat /etc/system-release
CentOS Linux release 7.7.1908 (Core)
[root@web01 yum.repos.d]# cd /etc/yum.repos.d/
[root@web01 yum.repos.d]# ls
CentOS-Base.repo  CentOS-Debuginfo.repo  CentOS-Media.repo    CentOS-Vault.repo  epel.repo
CentOS-CR.repo    CentOS-fasttrack.repo  CentOS-Sources.repo  docker-ce.repo     epel-testing.repo
[root@web01
yum.repos.d]# mv CentOS-Base.repo CentOS-Base.repo.backup # 备份

[root@web01 yum.repos.d]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

  [root@web01 yum.repos.d]# yum makecache    --更新源数据缓存

  [root@web01 yum.repos.d]# yum -y update

  已加载插件:fastestmirror
  Loading mirror speeds from cached hostfile
  * base: mirrors.aliyun.com
  * epel: fedora.cs.nctu.edu.tw
  * extras: mirrors.aliyun.com
  * updates: mirrors.aliyun.com
  正在解决依赖关系

 4.查看操作系统版本与位数

[root@web01 docker]# uname -s
Linux
[root@web01 docker]# uname -rv
3.10.0-1062.el7.x86_64 #1 SMP Wed Aug 7 18:08:02 UTC 2019
[root@web01 docker]# uname -m
x86_64

5.查看当前系统时区与时间设置

[root@web01 etc]# timedatectl
      Local time: 三 2019-10-16 09:13:10 CST
  Universal time: 三 2019-10-16 01:13:10 UTC
        RTC time: 三 2019-10-16 09:05:06
       Time zone: Asia/Shanghai (CST, +0800)
     NTP enabled: yes
NTP synchronized: no
 RTC in local TZ: no
      DST active: n/a
[root@web01 etc]# ntpdate ntp1.aliyun.com #与阿里云时间服务器同步
16 Oct 09:15:20 ntpdate[15406]: adjust time server 120.25.115.20 offset 0.002538 sec
时间诇整指令
1 timedatectl list-timezones: 列出所有时区
2 timedatectl set-local-rtc 1 将硬件时钟调整为与本地时钟一致, 0 为设置为 UTC 时间
3 timedatectl set-timezone Asia/Shanghai 设置系统时区为上海

 

  

 

 

 

 

 

 

posted on 2019-10-15 16:36  湖东  阅读(1519)  评论(0编辑  收藏  举报