举例:服务器两块硬盘,一块是系统盘 100G,一块是数据盘 200G。我想把宝塔面板安装到 200G 数据盘上,目前宝塔面板安装默认目录为/www 目录,不支持修改。随着后期环境软件 Nginx、Apache、PHP、MYSQL、python、docker 等安装,都会默认安装到系统盘内/www 下,这样一来,我们系统盘很快就会不够使用,那么我们怎么来解决呢?
看一下服务器磁盘使用状况1[root@ecs-267411 ~]# df -vh 2Filesystem Size Used Avail Use% Mounted on 3devtmpfs 4.0M 0 4.0M 0% /dev 4tmpfs 7.8G 0 7.8G 0% /dev/shm 5tmpfs 7.8G 8.6M 7.8G 1% /run 6tmpfs 4.0M 0 4.0M 0% /sys/fs/cgroup 7/dev/vda1 99G 2.5G 92G 3% / 8tmpfs 7.8G 0 7.8G 0% /tmp
查看一下系统所有分区1[root@ecs-267411 ~]# fdisk -l 2Disk /dev/vda: 100 GiB, 107374182400 bytes, 209715200 sectors 3Units: sectors of 1 * 512 = 512 bytes 4Sector size (logical/physical): 512 bytes / 512 bytes 5I/O size (minimum/optimal): 512 bytes / 512 bytes 6Disklabel type: dos 7Disk identifier: 0x73839ead 8 9Device Boot Start End Sectors Size Id Type 10/dev/vda1 * 2048 209715166 209713119 100G 83 Linux 11 12Disk /dev/vdb: 200 GiB, 214748364800 bytes, 419430400 sectors 13Units: sectors of 1 * 512 = 512 bytes 14Sector size (logical/physical): 512 bytes / 512 bytes 15I/O size (minimum/optimal): 512 bytes / 512 bytes
把 200G 的数据盘,格式化 mkfs.ext31[root@ecs-267411 ~]# mkfs.ext3 /dev/vdb 2mke2fs 1.46.4 (18-Aug-2021) 3Creating filesystem with 52428800 4k blocks and 13107200 inodes 4Filesystem UUID: 9c92ce47-e785-4110-bcd5-59d1bc1b83c8 5Superblock backups stored on blocks: 6 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 7 4096000, 7962624, 11239424, 20480000, 23887872 8 9+Allocating group tables: done 10+Writing inode tables: done 11+Creating journal (262144 blocks): done 12+Writing superblocks and filesystem accounting information: done
创建一个目录,给权限,并挂载 200G 数据盘1[root@ecs-267411 ~]# mkdir /HNDISK 2[root@ecs-267411 ~]# chmod -R 777 /HNDISK/ 3[root@ecs-267411 ~]# mount /dev/vdb /HNDISK/ 4[root@ecs-267411 ~]# df -lh 5Filesystem Size Used Avail Use% Mounted on 6devtmpfs 4.0M 0 4.0M 0% /dev 7tmpfs 7.8G 0 7.8G 0% /dev/shm 8tmpfs 7.8G 8.6M 7.8G 1% /run 9tmpfs 4.0M 0 4.0M 0% /sys/fs/cgroup 10/dev/vda1 99G 2.5G 92G 3% / 11tmpfs 7.8G 0 7.8G 0% /tmp 12+/dev/vdb 196G 1.1M 186G 1% /HNDISK
建立软连接 使用 ln -s /HNDISK /www 命令建立从根目录的 www 到/HNDISK 的软连接。这样,在安装宝塔面板时,虽然看起来是安装在根目录的 www 下,实际上数据会存储在/HNDISK 目录中
1[root@ecs-267411 ~]# ln -s /HNDISK /www
查看/www 软链接指向的目标路径1[root@ecs-267411 ~]# readlink /www 2/HNDISK
添加启动项,并重起服务器1[root@ecs-267411 ~]# echo /dev/vdb /HNDISK ext3 defaults 0 0 >> /etc/fstab 2[root@ecs-267411 ~]# init 6
重起后,查看一下磁盘情况,在看一下/www 指向1[root@ecs-267411 ~]# df -lh 2Filesystem Size Used Avail Use% Mounted on 3devtmpfs 4.0M 0 4.0M 0% /dev 4tmpfs 7.8G 4.0K 7.8G 1% /dev/shm 5tmpfs 7.8G 8.6M 7.8G 1% /run 6tmpfs 4.0M 0 4.0M 0% /sys/fs/cgroup 7/dev/vda1 99G 2.5G 92G 3% / 8tmpfs 7.8G 0 7.8G 0% /tmp 9+/dev/vdb 196G 1.1M 186G 1% /HNDISK 10[root@ecs-267411 ~]# readlink /www 11+/HNDISK 12[root@ecs-267411 ~]#
一键安装宝塔面板1[root@ecs-267411 ~]# url=https://download.bt.cn/install/install_lts.sh;if [ -f /usr/bin/curl ];then curl -sSO $url;else wget -O install_lts.sh $url;fi;bash install_lts.sh ed8484bec 2 3#---------------------------------------------------------------------- 4| Bt-WebPanel FOR CentOS/Ubuntu/Debian 5#---------------------------------------------------------------------- 6| Copyright © 2015-2099 BT-SOFT(http://www.bt.cn) All rights reserved. 7#---------------------------------------------------------------------- 8| The WebPanel URL will be http://SERVER_IP:41862 when installed. 9#---------------------------------------------------------------------- 10| 为了您的正常使用,请确保使用全新或纯净的系统安装宝塔面板,不支持已部署项目/环境的系统安装 11#---------------------------------------------------------------------- 12| 当前您正在安装的是宝塔面板稳定版-9.0-lts 13#---------------------------------------------------------------------- 14 15Do you want to install Bt-Panel to the /www directory now?(y/n): y
安装完成后,输出管理面板信息1======================================== 2正在开启面板SSL,请稍等............ 3======================================== 4证书开启成功! 5======================================== 6Stopping Bt-Tasks... done 7Stopping Bt-Panel... done 8Starting Bt-Panel.... done 9Starting Bt-Tasks... done 10cat: /etc/redhat-release: No such file or directory 11cat: /etc/redhat-release: No such file or directory 12Last metadata expiration check: 0:22:26 ago on Sat 07 Dec 2024 08:41:34 PM CST. 13Package firewalld-1.0.2-2.r13.hce2.noarch is already installed. 14Dependencies resolved. 15Nothing to do. 16Complete! 17Created symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service → /usr/lib/systemd/system/firewalld.service. 18Created symlink /etc/systemd/system/multi-user.target.wants/firewalld.service → /usr/lib/systemd/system/firewalld.service. 19success 20True 21================================================================== 22Congratulations! Installed successfully! 23=============注意:首次打开面板浏览器将提示不安全================= 24 25 请选择以下其中一种方式解决不安全提醒 26 1、下载证书,地址:https://dg2.bt.cn/ssl/baota_root.pfx 双击安装,密码【www.bt.cn】 27 2、点击【高级】-【继续访问】或【接受风险并继续】访问 28 教程:https://www.bt.cn/bbs/thread-117246-1-1.html 29 mac用户请下载使用此证书:https://dg2.bt.cn/ssl/baota_root.crt 30 31========================面板账户登录信息========================== 32 33+ 【云服务器】请在安全组放行 41862 端口 34+ 外网面板地址: https://113.44.32.158:41862/0554b4df 35+ 内网面板地址: https://192.168.0.9:41862/0554b4df 36+ username: 19kfsbc9 37+ password: c35e1822 38 39 浏览器访问以下链接,添加宝塔客服 40 https://www.bt.cn/new/wechat_customer 41================================================================== 42Time consumed: 11 Minute!
上一篇:余生不长,家和为伴,乘风破浪的家和长者! 下一篇:没有了... |