<博客建立历程>阿里云建站1——准备
目录:
阿里云Ecs购置
购买的配置基本算是最低的配置了,如下图所示。一方面因为博主日后需要在这个集群上搭建一个hadoop集群使用,另一方面需要搭建一些集群磁盘方面的监控,所以需要两个磁盘,如果你只是搭建一个博客完全不需这两个磁盘的。
购买后会给你一个内网IP和一个外网IP,外网IP留作ssh登录使用,配置像hadoop集群的话需要使用内网IP。
登录阿里云Ecs
我通过的是Xshell登录的阿里云Ecs。
上去的时候主机名字是Ecs的序号,看着不爽的可以修改一下,我反正是修改了。
修改主机名
[root@why /]vi /etc/sysconfig/network
[root@why /]vi /etc/hosts
修改这两个的位置的hostname即可。
重启一下电脑。
[root@why /]init 6
检查一下磁盘是否挂载
[root@why /]# df -h
磁盘没有挂载
开始格盘挂载
查看一下磁盘名字
[root@why /]# fdisk -l
开始格式化磁盘
[root@why /]# mkfs.ext4 /dev/xvdb
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
5242880 inodes, 20971520 blocks
1048576 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
640 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
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 28 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@why /]# echo $?
0
[root@why /]# mkfs.ext4 /dev/xvdc
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
5242880 inodes, 20971520 blocks
1048576 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
640 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
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 22 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@why /]# echo $?
0
磁盘挂载
一个data目录用作数据存放,一个program目录用作程序目录。
[root@why /]# cd /mnt/
[root@why mnt]# ll
total 0
[root@why mnt]# mkdir data
[root@why mnt]# mkdir program
[root@why mnt]# mount /dev/xvdb /mnt/program/
[root@why mnt]# mount /dev/xvdc /mnt/data/
[root@why mnt]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/xvda1 40G 1.5G 36G 4% /
tmpfs 498M 0 498M 0% /dev/shm
/dev/xvdb 79G 56M 75G 1% /mnt/program
/dev/xvdc 79G 56M 75G 1% /mnt/data
设置磁盘开机挂载
[root@why mnt]# vi /etc/fstab
#
# /etc/fstab
# Created by anaconda on Thu Aug 14 21:16:42 2014
#
# 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=94e4e384-0ace-437f-bc96-057dd64f42ee / ext4 defaults,barrier=0 1 1
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
/dev/xvdb /mnt/program ext4 defaults 0 0
/dev/xvdc /mnt/data ext4 defaults 0 0
最后看一下配置