帮助文档 > 系统入门 > 服务器相关问题 > CentOS

宝塔Linux面板安装

宝塔Linux面板安装


安装命令(编译安装,稳定、适用于生产环境,耗时长,约30分钟到2小时):

yum -y install screen wget && screen -S bt
wget -O install.sh http://download.bt.cn/src/install.sh && sh install.sh

登录服务器,查看服务器环境版本

huoniao-08.png

huoniao-09.png

huoniao-10.png

huoniao-11.png

huoniao-12.png

安装
yum install lsb –y
查看版本
[root@gainetbhmjtu ~]# lsb_release -a
LSB Version:	:core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:desktop-4.1-amd64:desktop-4.1-noarch:languages-4.1-amd64:languages-4.1
-noarch:printing-4.1-amd64:printing-4.1-noarch
Distributor ID:	CentOS
Description:	CentOS Linux release 7.2.1511 (Core) 
Release:	7.2.1511
Codename:	Core
[root@gainetbhmjtu ~]#
查看一下服务器硬盘
[root@gainetbhmjtu ~]# fdisk -l

Disk /dev/vda: 21.5 GB, 21474836480 bytes, 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000b9295

   Device Boot      Start         End      Blocks   Id  System
/dev/vda1   *        2048     1026047      512000   83  Linux
/dev/vda2         1026048    41943039    20458496   8e  Linux LVM

Disk /dev/vdb: 214.7 GB, 214748364800 bytes, 419430400 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x0b0ab58c

   Device Boot      Start         End      Blocks   Id  System
/dev/vdb1            2048   419428351   209713152    f  W95 Ext'd (LBA)
/dev/vdb5            4096   419428351   209712128    7  HPFS/NTFS/exFAT

Disk /dev/mapper/centos-root: 18.8 GB, 18756927488 bytes, 36634624 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mapper/centos-swap: 2147 MB, 2147483648 bytes, 4194304 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

[root@gainetbhmjtu ~]#

查看到 214.7GB硬盘没有挂载 Disk /dev/vdb: 214.7 GB, 214748364800 bytes, 419430400 sectors

挂载方法和教程 http://help.kumanyun.com/help-11-1.html


我们切换到根目录下面,新建一个www文件夹,直接挂载硬盘 /dev/vdb 到 /www 目录

[root@gainetbhmjtu ~]# cd /
[root@gainetbhmjtu /]# mkdir www
[root@gainetbhmjtu /]# mount /dev/vdb /www
mount: /dev/vdb is write-protected, mounting read-only
mount: unknown filesystem type '(null)'

提示大概意思是说你失败了,你所挂载的对象不可写(write-protected),挂载的硬盘为只读(read-only),文件系统类型不对(filesystem tyle)。

我们格式化为LINUX支持格式

[root@gainetbhmjtu /]# mkfs.ext3 /dev/vdb
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
13107200 inodes, 52428800 blocks
2621440 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
1600 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks: 
	32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
	4096000, 7962624, 11239424, 20480000, 23887872

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

格式化完成后,重新挂载,添加开机启动,重起服务器。

[root@gainetbhmjtu /]# mount /dev/vdb /www
[root@gainetbhmjtu /]# echo '/dev/vdb /www ext3 defaults 0 0' >> /etc/fstab
[root@gainetbhmjtu /]# init 6

Connection closed by foreign host.

Disconnected from remote host(linux bt) at 09:36:31.

Type `help' to learn how to use Xshell prompt.
[c:\~]$

重起服务器后,看一下我们刚刚挂载的状态

[root@gainetbhmjtu ~]# df -T
Filesystem              Type     1K-blocks    Used Available Use% Mounted on
/dev/mapper/centos-root xfs       18307072 1231324  17075748   7% /
devtmpfs                devtmpfs   1930852       0   1930852   0% /dev
tmpfs                   tmpfs      1941036       0   1941036   0% /dev/shm
tmpfs                   tmpfs      1941036   16684   1924352   1% /run
tmpfs                   tmpfs      1941036       0   1941036   0% /sys/fs/cgroup
/dev/vdb                ext3     206293688   60816 195747112   1% /www
/dev/vda1               xfs         508588  125504    383084  25% /boot
tmpfs                   tmpfs       388208       0    388208   0% /run/user/0
[root@gainetbhmjtu ~]#

显示挂载成功  214.7 GB 顺利挂载到 /www 目录~

/dev/vdb                ext3     206293688   60816 195747112   1% /www

进入/www 目录 下载安装 

[root@gainetbhmjtu ~]# cd /www
[root@gainetbhmjtu www]# yum -y install screen wget && screen -S bt
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package screen.x86_64 0:4.1.0-0.23.20120314git3c2946.el7_2 will be installed
---> Package wget.x86_64 0:1.14-10.el7_0.1 will be updated
---> Package wget.x86_64 0:1.14-13.el7 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

===========================================================================================================================
 Package       Arch         Version                         Repository     Size
===========================================================================================================================
Installing:
 screen       x86_64    4.1.0-0.23.20120314git3c2946.el7_2       base        552 k
Updating:
 wget        x86_64      1.14-13.el7                base        546 k

Transaction Summary
===========================================================================================================================
Install  1 Package
Upgrade  1 Package

Total download size: 1.1 M
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
(1/2): screen-4.1.0-0.23.20120314git3c2946.el7_2.x86_64.rpm                   | 552 kB  00:00:00     
(2/2): wget-1.14-13.el7.x86_64.rpm                                | 546 kB  00:00:00     
---------------------------------------------------------------------------------------------------------------------------
Total                                         1.5 MB/s | 1.1 MB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : screen-4.1.0-0.23.20120314git3c2946.el7_2.x86_64                   1/3 
  Updating   : wget-1.14-13.el7.x86_64                              2/3 
  Cleanup    : wget-1.14-10.el7_0.1.x86_64                            3/3 
  Verifying  : wget-1.14-13.el7.x86_64                               1/3 
  Verifying  : screen-4.1.0-0.23.20120314git3c2946.el7_2.x86_64                  2/3 
  Verifying  : wget-1.14-10.el7_0.1.x86_64                             3/3 

Installed:
  screen.x86_64 0:4.1.0-0.23.20120314git3c2946.el7_2                                  

Updated:
  wget.x86_64 0:1.14-13.el7            

Complete!

[root@gainetbhmjtu www]#

下载安装,如果在

国内的话,选择广东源,2) CHINA - Guangdong,如果香港的话 1) CHINA - Hong Kong,选择,如果境外的话,选择 3) U.S.A - Los Angeles,输入2后,回车。

网站服务器的话,我们就选择 nginx ,选择 Nginx-1.10.3[default],输入1,回车

PHP解析引擎,我们这里选择5.6版本,选择 5) PHP-5.6,输入5,回车

数据库版,我们这里选择5.6版本,选择 3) MySQL 5.6,输入3,回车

安装目录选择,我们默认到挂载的硬盘 根目录 /www ,输入y,回来,执行安装,安装速度是由服务器产环境和网络带宽决定,耗时长,约30分钟到2小时!

[root@gainetbhmjtu www]# wget -O install.sh http://download.bt.cn/src/install.sh && sh install.sh
--2017-04-14 09:54:36--  http://download.bt.cn/src/install.sh
Resolving download.bt.cn (download.bt.cn)... 103.224.251.79
Connecting to download.bt.cn (download.bt.cn)|103.224.251.79|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 115460 (113K) [application/octet-stream]
Saving to: ‘install.sh’

100%[==================================================================================>] 115,460     --.-K/s   in 0.1s    

2017-04-14 09:54:37 (889 KB/s) - ‘install.sh’ saved [115460/115460]


+----------------------------------------------------------------------
| Bt-WebPanel 2.8 FOR CentOS
+----------------------------------------------------------------------
| Copyright (c) 2015-2017 BT-SOFT(http://www.bt.cn) All rights reserved.
+----------------------------------------------------------------------
| Tengine-2.2.0/Nginx1.8-1.10/Apache2.4/MySQL5.5-5.7/PHP5.2-7.0/Pure-Ftpd1.0.45
+----------------------------------------------------------------------
| Thanks to Lnmp.org
+----------------------------------------------------------------------

==============================================
1) CHINA - Hong Kong
2) CHINA - Guangdong
3) U.S.A - Los Angeles
Please select download node (1-3 default:1): 2
=======================================================
1) Nginx-1.10.3[default]
2) Nginx-1.8.1
3) Tengine-2.2.0
4) Apache-2.4.25 + php-fpm
5) Apache-2.2.32 + php5_mod
Plese select Web Server(1-5 default:1): 1
=======================================================
1) PHP-5.2
2) PHP-5.3
3) PHP-5.4[default]
4) PHP-5.5
5) PHP-5.6
6) PHP-7.0
7) ALL version
8) PHP-5.2/5.3/5.4
9) PHP-7.1 [NEW]
Plese select php version(1-9 default:3): 5
=======================================================
1) MySQL 5.5[default]
2) MySQL 5.5[RPM] 
3) MySQL 5.6
4) AliSQL 5.6 
5) MySQL 5.7
Plese select mysql version(1-5 default:1): 3
=======================================================
=======================================================
=======================================================
Your selected results to:
-------------------------------------------------------
Web Server: nginx1.10.3
PHP version: 5.6
MySQL version: 5.6
MySQL Password: 1041b5d6d17129bc
-------------------------------------------------------
Expected installation: 60 Minute
=======================================================
About to install /www , Start the installation?(y/n): y

安装完成后,输入服务器IP地址,加端口888,进行设置

=====================================
The install successful!
=====================================

DefaultSiteUrl: http://SERVER_IP:888
MySQLPassword: 1041b5d6d17129bc (MYSQL登录密码)
phpMyAdmin: http://SERVER_IP:888/phpmyadmin_b3609189ac

=====================================
mv: cannot stat ‘install.sh’: No such file or directory
Time consuming: 48 Minute!
[root@gainetbhmjtu www]#

huoniao-13.png

huoniao-14.png

huoniao-15.png


教程结束~


目录结构:

/www 

/www/wwwroot                    站点目录

/www/wwwroot/default               WEB面板目录

/www/server/nginx/conf/vhost         nginx网站配置目录

/www/server/nginx                nginx安装目录

/www/server/apache/conf/vhost        apache网站配置目录

/www/server/apache                apache安装目录

/www/server/mysql                mysql安装目录

/www/server/php                  PHP安装目录

/www/server/pure-ftpd              ftp安装目录

/www/server/data                 数据库文件目录

查看默认信息 cat /www/server/default.pl

如何卸载:
命令:sh /www/server/uninstall.sh
警告:会卸载所有使用宝塔安装的环境包,会自动备份 Nginx配置文件、pure-ftpd数据库 、MySQL数据库目录 到 /www/backup/oldServer ,但不确保备份完整性,建议卸载前自行备份数据。