Linux init初始化

发布 : 2023-01-03 浏览 :

更新安装包

1
yum update

挂载硬盘

1
fdisk -l

Disk /dev/vda: 42.9 GB, 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
Disk label type: dos
Disk identifier: 0x000a9cf3

Device Boot Start End Blocks Id System
/dev/vda1 2048 8390655 4194304 82 Linux swap / Solaris
/dev/vda2 * 8390656 83886079 37747712 83 Linux

Disk /dev/vdb: 536.9 GB, 536870912000 bytes, 1048576000 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/vda: 42.9G
/dev/vdb: 536.9 GB

有一个没有挂载的硬盘 /dev/vdb

格式化分区

mkfs.ext4 /dev/vdb

挂载配置

vim /etc/fstab

1
2
3
4
5
6
7
8
9
10
#
# /etc/fstab
# Created by anaconda on Wed Feb 15 09:40:26 2017
#
# 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
#
UUID=0bdf1908-f065-4045-b6db-4b55e990cd0a / ext3 defaults 1 1
UUID=4a6701cf-4ad5-4011-b7c2-73d40a757a1d swap swap defaults 0 0
/dev/vdb /gzpykj ext4 defaults 0 0

创建对应的文件夹

mkdir /gzpykj

重新挂载所有分区

mount -a

检查是否挂载成功

df -h

1
2
3
4
5
6
7
8
9
[root@whngkzcsmxvephex /]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 7.8G 0 7.8G 0% /dev
tmpfs 7.8G 0 7.8G 0% /dev/shm
tmpfs 7.8G 329M 7.5G 5% /run
tmpfs 7.8G 0 7.8G 0% /sys/fs/cgroup
/dev/vda2 36G 4.1G 30G 13% /
tmpfs 1.6G 0 1.6G 0% /run/user/0
/dev/vdb 493G 73M 467G 1% /gzpykj

换yum源

1
2
3
4
5
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
wget -O Centos-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum makecache

yum -y install update

安装 nginx

vim /etc/yum.repos.d/nginx.repo

1
2
3
4
5
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=0
enabled=1
本文作者 : zhouinfo
原文链接 : http://blog.zhouinfo.site/2023/01/03/Linux-init%E5%88%9D%E5%A7%8B%E5%8C%96/
版权声明 : 本博客所有文章除特别声明外,均采用 CC Apache License 2.0 许可协议。转载请注明出处!
留下足迹