CentOS server initialization settings In fact, no Aliyun or other server, the operation configuration process and steps are similar, the following and small set together to see.
One, mounted hard disk
1, disk partition
Fdisk-l #查看设备, you can generally see the device named/dev/xvdb
Fdisk/dev/xvdb #对磁盘进行分区
Enter N #创建新分区
Enter P #创建主分区
Enter 1 #创建第一个主分区
Enter the W #保存并执行以上命令 to create the partition
After the above command has been completed, use Fdisk-l to see a similar
/DEV/XVDB1 of the partition
Indicates that the partition was successful.
2. Disk format
MKFS.EXT4/DEV/XVDB1 #对分区进行格式化 (www.jb51.net)
Description: EXT4 is the centos6.x default partition format, centos5.x please use ext3
After the format is complete (depending on the size of the partition, the time required for formatting is different, please wait patiently), mount the partition
3, mount the disk
For example: To mount the/DEV/XVDB1 to the/data directory
Mkdir-p/data #创建目录
Mount/dev/xvdb1/data #挂载
Df-h #查看挂载结果
Vi/etc/fstab #设置开机自动挂载, enter the following code on the last line
/dev/xvdb1/data EXT4 Defaults 0 0
: wq! #保存退出
Mount-a #使分区设置立即生效
The following is a small group of cloud-dwelling community for everyone to share some of the content, convenient for everyone to reference learning
Modifying the language environment
[root@oracledb ~]# sudo vim/etc/sysconfig/i18n
Change Zh_ch to "en_US." UTF-8 "
Build Yum Local Source
method to Be Continued
VSFTPD installation Configuration
Reference: CentOS Configure VSFTP Server
Yum Install vsftpd
Set VSFTPD boot
Last Login:tue Aug 08:21:26 2014 from L-001812.lan
[Root@oracledb ~]# chkconfig--list|grep vsftpd
VSFTPD 0:off 1:off 2:off 3:off 4:off 5:off 6:off
[Root@oracledb ~]# chkconfig vsftpd on
[Root@oracledb ~]# chkconfig--list|grep vsftpd
VSFTPD 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[Root@oracledb ~]#
Configuring Firewalls
Open/etc/sysconfig/iptables File
1.vi/etc/sysconfig/iptables
Add the following code before the Reject line
1.-a input-m State--state new-m tcp-p TCP--dport 21-j ACCEPT
Save and close the file, reboot the firewall
1.service iptables Restart
To create an FTP connection, the connection mode is active, and the character set is UTF8 (optional)
Modify FTP access Permissions
Using the command getsebool-a|grep FTP to view
[Root@oracledb vsftpd]# getsebool-a|grep FTP
Allow_ftpd_anon_write--> off
Allow_ftpd_full_access--> off
Allow_ftpd_use_cifs--> off
Allow_ftpd_use_nfs--> off
Ftp_home_dir--> off
ftpd_connect_db--> off
Ftpd_use_fusefs--> off
Ftpd_use_passive_mode--> off
Httpd_enable_ftp_server--> off
Tftp_anon_write--> off
Tftp_use_cifs--> off
Tftp_use_nfs--> off
See if the above red is on
Setsebool allow_ftpd_full_access on
Setsebool Ftp_home_dir on
[Root@oracledb vsftpd]# getsebool-a|grep FTP
Allow_ftpd_anon_write--> off
Allow_ftpd_full_access--> on
Allow_ftpd_use_cifs--> off
Allow_ftpd_use_nfs--> off
Ftp_home_dir--> on
ftpd_connect_db--> off
Ftpd_use_fusefs--> off
Ftpd_use_passive_mode--> off
Httpd_enable_ftp_server--> off
Tftp_anon_write--> off
Tftp_use_cifs--> off
Tftp_use_nfs--> off
Vi/etc/profile//Add content at end of file
#set Java environment
export Java_home=/usr/local/java
export classpath=./:$ Java_home/lib: $JAVA _home/jre/lib
export path= $PATH: $JAVA _home/bin
Set Static IP address
CentOS in the desktop environment set the IP address, but after the reboot through SSH can not login, must be under the desktop login account, start eth0 can be ping after. So under the desktop settings can not be enabled to enable the network card, you must modify the configuration file.
If we want to change the host address to a static address or change the host name, several files that need to be modified include:
/etc/sysconfig/network set host name and network configuration
/etc/sysconfig/network-scripts/ifcfg-eth0 settings for specific network adapters
/etc/resolv.conf Set DNS
/etc/hosts setting the specified domain name resolution address
Generally we only need to modify the network card configuration file Ifcfg-eth0 on it. The modification method is as follows
Vim/etc/sysconfig/network-scripts/ifcfg-eth0
Edit configuration file
[Root@map ~]# vim/etc/sysconfig/network-scripts/ifcfg-eth0
device=eth0
type=ethernet
UUID= 1e3f09ce-74aa-4d8b-9988-a6db9aef4d32
onboot=yes
nm_controlled=yes
bootproto=static
HWADDR= 00:50:56:b8:37:90
ipaddr=10.138.16.144
netmask=255.255.255.0
prefix=24
gateway= 10.138.16.254
defroute=yes
ipv4_failure_fatal=yes
ipv6init=no
name= "System eth0"
Explain
Device=eth0 #描述网卡对应的设备别名, for example, in a Ifcfg-eth0 file for eth0
bootproto=static #设置网卡获得ip地址的方式, the possible option is STATIC,DHCP or BOOTP, Corresponding to the static specified IP address, the IP address obtained through the DHCP protocol, the IP address
broadcast=192.168.0.255 #对应的子网广播地址 Hwaddr=00:07:e9:05:e8 obtained through the BOOTP protocol.
: B4 #对应的网卡物理地址
ipaddr=12.168.1.2 #ip地址
ipv6init=no//Can be added, or can be added without
ipv6_autoconf=no//ditto
netmask= 255.255.255.0 #网卡对应的网络掩码
gateway=10.138.16.254 #网关
onboot=yes #系统启动时是否设置此网络接口, when set to Yes, this device is activated when the system starts
Reboot causes configuration to take effect
Service Network restart