1.linux 查看磁盘分区格式
[root@zxserver102 ~]# df -T /dev/sda1 Filesystem Type 1K-blocks Used Available Use% Mounted on /dev/sda1 ext4 487652 40637 421415 9% /boot
2.格式化硬盘(ext4)
[root@zxserver102 ~]# mkfs -t ext4 -c /dev/sdb1 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 52428800 inodes, 209714510 blocks 10485725 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=4294967296 6400 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, 71663616, 78675968, 102400000 Checking for bad blocks (read-only test): done Writing inode tables: done Creating journal (32768 blocks): done Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 31 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override.
3.fstab挂载
# # /etc/fstab # Created by anaconda on Mon Jul 25 22:51:55 2016 # # 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 # /dev/mapper/vg_zxserver01-lv_root / ext4 defaults 1 1 UUID=50722c5e-d161-4dd6-9390-e22b74e903d8 /boot ext4 defaults 1 2 /dev/mapper/vg_zxserver01-lv_home /home ext4 defaults 1 2 /dev/mapper/vg_zxserver01-lv_swap swap swap defaults 0 0 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/sdb1 /zx_db_data ext4 defaults 1 2
4.安装epel
centos6.x: yum install http://mirrors.aliyun.com/epel/6/x86_64/epel-release-6-8.noarch.rpm -y centos7.x: yum install http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm -y
5.修改密码
echo "xxxxxxxx"|passwd --stdin root
6.指定nologin用户执行命令
为了安全,使用nologin账号来运行程序
su -s /bin/bash -c "ls" www
这条命令到底做了什么呢?su -s 是指定shell,这里www用户是nologin用户,是没有默认的shell的,这里指定使用/bin/bash, -c 后面接需要运行的命令, 后面www是用www用户来运行
7.IPTABLES封IP
iptables -I INPUT -s 61.147.121.XXX -j DROP
8.IPTABLES开放端口
iptables -P INPUT ACCEPT iptables -P OUTPUT ACCEPT
#开放所有端口
iptables -A INPUT -p tcp -m tcp --dport 8080 -j ACCEPT
9.更改主机名(centos7)
hostnamectl --static set-hostname k8s-master
10.设置代理ip
export http_proxy="http://child-prc.intel.com:913" export https_proxy="http://child-prc.intel.com:913"