風(fēng)信建站新開發(fā)項目應(yīng)用于Linux服務(wù)器,操作系統(tǒng)為CentOS Linux 8.2,下面我們將新購服務(wù)器進行的一些初始化操作及配置相關(guān)運行環(huán)境,便于新項目的運行。
	[root@iZbp1emne76ykf63euczfpZ ~]# cat /etc/redhat-release 
	CentOS Linux release 8.2.2004 (Core) 
	1、查看磁盤目前的初始情況
	[root@iZbp1emne76ykf63euczfpZ ~]# fdisk -l
	Disk /dev/vda: 20 GiB, 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
	Disklabel type: dos
	Disk identifier: 0x4500abcf
	Device     Boot Start      End  Sectors Size Id Type
	/dev/vda1  *     2048 41943039 41940992  20G 83 Linux
	Disk /dev/vdb: 40 GiB, 42949672960 bytes, 83886080 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
	2、對/dev/vdb磁盤進行初始化
	[root@iZbp1emne76ykf63euczfpZ ~]# fdisk /dev/vdb
	Welcome to fdisk (util-linux 2.32.1).
	Changes will remain in memory only, until you decide to write them.
	Be careful before using the write command.
	Device does not contain a recognized partition table.
	Created a new DOS disklabel with disk identifier 0x8333cdc4.
	輸入命令(輸入“n”,按“Enter”,開始新建分區(qū))
	Command (m for help): n
	Partition type
	   p   primary (0 primary, 0 extended, 4 free)
	   e   extended (container for logical partitions)
	輸入命令(輸入“p”,按“Enter”,開始新建主分區(qū))
	Select (default p): p
	輸入命令(輸入主分區(qū)編號“1”,按“Enter”)
	Partition number (1-4, default 1): 1
	First sector (2048-83886079, default 2048): 
	Last sector, +sectors or +size{K,M,G,T,P} (2048-83886079, default 83886079):
	Created a new partition 1 of type 'Linux' and of size 40 GiB.
	輸入命令(輸入“p”,按“Enter”),查看新建分區(qū)的詳細信息
	Command (m for help): p
	Disk /dev/vdb: 40 GiB, 42949672960 bytes, 83886080 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
	Disklabel type: dos
	Disk identifier: 0x8333cdc4
	Device     Boot Start      End  Sectors Size Id Type
	/dev/vdb1        2048 83886079 83884032  40G 83 Linux
	輸入命令(輸入“w”,按“Enter”),保存分區(qū)表信息。
	Command (m for help): w
	The partition table has been altered.
	Calling ioctl() to re-read partition table.
	Syncing disks.
	3、設(shè)置/dev/vdb1數(shù)據(jù)盤文件系統(tǒng)的格式
	[root@iZbp1emne76ykf63euczfpZ ~]# mkfs -t ext4 /dev/vdb1
	mke2fs 1.45.4 (23-Sep-2019)
	Creating filesystem with 10485504 4k blocks and 2621440 inodes
	Filesystem UUID: c2f07f3a-a93d-4e29-8d2b-7326f66fbf39
	Superblock backups stored on blocks: 
	32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
	4096000, 7962624
	Allocating group tables: done                            
	Writing inode tables: done                            
	Creating journal (65536 blocks): done
	Writing superblocks and filesystem accounting information: done 
	4、設(shè)置掛載的目錄
	[root@iZbp1emne76ykf63euczfpZ /]# mkdir www
	5、將/dev/vdb1數(shù)據(jù)盤掛載到www目錄
	[root@iZbp1emne76ykf63euczfpZ /]# mount /dev/vdb1 /www
	6、掛載成功之后,查看掛載結(jié)果
	[root@iZbp1emne76ykf63euczfpZ /]# df -TH
	Filesystem     Type      Size  Used Avail Use% Mounted on
	devtmpfs       devtmpfs  888M     0  888M   0% /dev
	tmpfs          tmpfs     904M     0  904M   0% /dev/shm
	tmpfs          tmpfs     904M  484k  904M   1% /run
	tmpfs          tmpfs     904M     0  904M   0% /sys/fs/cgroup
	/dev/vda1      xfs        22G  2.8G   19G  13% /
	tmpfs          tmpfs     181M     0  181M   0% /run/user/0
	/dev/vdb1      ext4       43G   51M   40G   1% /www
	7、設(shè)置開機自動掛載/dev/vdb1數(shù)據(jù)盤
	查詢/dev/vdb1數(shù)據(jù)盤的UUID
	[root@iZbp1emne76ykf63euczfpZ /]# blkid /dev/vdb1
	/dev/vdb1: UUID="c2f07f3a-a93d-4e29-8d2b-7326f66fbf39" TYPE="ext4" PARTUUID="8333cdc4-01"
	使用vi命令編輯fstab文件,將數(shù)據(jù)盤的UUID信息保存至fstab文件中。
	[root@iZbp1emne76ykf63euczfpZ /]#vi /etc/fstab
	#
	# /etc/fstab
	# Created by anaconda on Mon Aug 24 06:23:59 2020
	#
	# Accessible filesystems, by reference, are maintained under '/dev/disk/'.
	# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info.
	#
	# After editing this file, run 'systemctl daemon-reload' to update systemd
	# units generated from this file.
	#
	UUID=32f2af94-a1cd-4880-bb61-9ede22264d88 /                       xfs     defaults        0 0
	UUID=c2f07f3a-a93d-4e29-8d2b-7326f66fbf39 /www ext4 defaults 0 2
	按“i”,進入編輯模式。
	將光標(biāo)移至文件末尾,按“Enter”,添加如下內(nèi)容。UUID=UUID=c2f07f3a-a93d-4e29-8d2b-7326f66fbf39 /mnt/sdc ext4 defaults 0 2
	按“ESC”后,輸入“:wq”,按“Enter”,保存設(shè)置并退出編輯器,至此,數(shù)據(jù)盤的操作已經(jīng)完成,我們可以開始布署運行環(huán)境。
	風(fēng)信建站網(wǎng)站定制功能開發(fā)、微信公眾號開發(fā)、小程序開發(fā)、企業(yè)官網(wǎng)重構(gòu),企業(yè)官網(wǎng)安全漏洞修復(fù),請致電:189-8648-0214
                    


 鄂公網(wǎng)安備 42090202000212號
鄂公網(wǎng)安備 42090202000212號