安装前先挂载数据盘(使用的阿里云ECS,系统里面挂载两块磁盘,一块系统盘一块数据盘)我们是安装软件在系统盘,应用全部在数据盘。
磁盘格式化
[root@iZ2ze8pbai447ra1ktofymZ ~]# 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: 0x0000974b Device Boot Start End Blocks Id System /dev/vda1 * 2048 83886046 41941999+ 83 Linux Disk /dev/vdb: 107.4 GB, 107374182400 bytes, 209715200 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@iZ2ze8pbai447ra1ktofymZ ~]# 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: 0x0000974b Device Boot Start End Blocks Id System /dev/vda1 * 2048 83886046 41941999+ 83 Linux Disk /dev/vdb: 107.4 GB, 107374182400 bytes, 209715200 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@iZ2ze8pbai447ra1ktofymZ ~]# fdisk /dev/vdb Welcome to fdisk (util-linux 2.23.2). 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 Building a new DOS disklabel with disk identifier 0x619faf48. Command (m for help): n Partition type: p primary (0 primary, 0 extended, 4 free) e extended Select (default p): p Partition number (1-4, default 1): 1 First sector (2048-209715199, default 2048): Using default value 2048 Last sector, +sectors or +size{K,M,G} (2048-209715199, default 209715199): Using default value 209715199 Partition 1 of type Linux and of size 100 GiB is set Command (m for help): wq The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks.
格式化
[root@iZ2ze8pbai447ra1ktofymZ ~]# mkfs.ext4 /dev/vdb1 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 6553600 inodes, 26214144 blocks 1310707 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=2174746624 800 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
磁盘挂载,在/home目录下
[root@iZ2ze8pbai447ra1ktofymZ ~]# df -h Filesystem Size Used Avail Use% Mounted on devtmpfs 3.8G 0 3.8G 0% /dev tmpfs 3.8G 0 3.8G 0% /dev/shm tmpfs 3.8G 440K 3.8G 1% /run tmpfs 3.8G 0 3.8G 0% /sys/fs/cgroup /dev/vda1 40G 2.1G 36G 6% / tmpfs 768M 0 768M 0% /run/user/0 [root@iZ2ze8pbai447ra1ktofymZ ~]# echo /dev/vdb1 /home ext4 defaults 0 0 >> /etc/fstab
重启服务器验证
[root@iZ2ze8pbai447ra1ktofymZ ~]# df -h Filesystem Size Used Avail Use% Mounted on devtmpfs 3.8G 0 3.8G 0% /dev tmpfs 3.8G 0 3.8G 0% /dev/shm tmpfs 3.8G 444K 3.8G 1% /run tmpfs 3.8G 0 3.8G 0% /sys/fs/cgroup /dev/vda1 40G 2.1G 36G 6% / /dev/vdb1 99G 61M 94G 1% /home tmpfs 768M 0 768M 0% /run/user/0
创建普通用户
[root@iZ2zee6df2m25shq6mfaw5Z ~]# useradd xiaoxin
由于是开发环境,所以授权这个用户的所有权。
[root@iZ2zee6df2m25shq6mfaw5Z ~]# visudo xiaoxin ALL=(ALL) NOPASSWD: ALL
切换到普通用户安装ansible
[root@iZ2zee6df2m25shq6mfaw5Z ~]# su - xiaoxin [xiaoxin@iZ2zee6df2m25shq6mfaw5Z ~]$ [xiaoxin@iZ2zee6df2m25shq6mfaw5Z ~]$ sudo yum install -y epel-release [xiaoxin@iZ2zee6df2m25shq6mfaw5Z ~]$ sudo yum install -y ansible
继续阅读
- 我的QQ
- QQ扫一扫
-
- 我的头条
- 头条扫一扫
-
评论