In the company operations, deploying a new server is a frequent occurrence, but also as a maintenance personnel need to master the basic skills.
Occurrence background:
1. Deploying a test environment for a production environment
2. Deploying a new environment for new systems
Steps:
1. Partition disk space
2. Custom Installation
3. Modify the computer name
4. Configure the Network
5.SElinux
6.Iptables
7. System time
8. Configure the Yum source
9. Installing VMware Tools (virtual machine environment)
First, partition disk space
/boot (120M); Swap (physical memory size);/(all remaining space)
Note:
The ① root directory (/) is where all Linux files and directories are located and must be allocated space (Mount disk partitions).
② tend to create custom directories and allocate disk partitions for server usage.
Ii.. Custom Installation
Depending on the server role, the installation option can also be minimal, followed by Yum or other installation on demand.
Third, modify the computer name
① system initialization can be defined according to the prompts.
② enter the system and make changes.
Command Line modification:
#vi/etc/sysconfig/network
Hostname=xxxxx
Iv. Configuring the Network
① system initialization can be defined according to the prompts.
② enter the system and make changes.
Graphical interface:
Setup
Command line:
#vi/etc/sysconfig/network-scripts/ifcfg-eth0
Device=eth0
Bootproto=none
broadcast=192.168.110.255
Hwaddr=00:0c:29:f6:31:3d
ipaddr=192.168.110.14
netmask=255.255.255.0
network=192.168.110.0
Onboot=yes
gateway=192.168.110.1
Type=ethernet
#/etc/init.d/network Restart (Restart Network Service)
#ifcfg (View configuration)
#cat Chkconfig--list | grep Network (view boot level, guaranteed default boot-up)
Network 0: Off 1: Off 2: Enable 3: Enable 4: Enable 5: Enable 6: Off
The startup levels are as follows:
0-halt (do not set Initdefault to this)
1-single User mode
2-multiuser, without NFS (the same as 3, if you don't have networking)
3-full multiuser mode
4-unused
5-x11
6-reboot (do not set Initdefault to this)
To modify the startup level:
#chkconfig--level XX Network on/off
V. SElinux
#getenforce (view current status)
#setenforce-help (see Help to clarify what the SELinux states are)
#setenforce 0/1
#vi/etc/selinux/config (the SELinux is generally closed to avoid the hassle of network debugging)
Selinux=disabled
#reboot ( system restart is in effect)
Liu, Iptables
#iptables-L--line-numbers (view)
To add a new entry:
#iptables-I INPUT 6-p TCP--dport 12489-j ACCEPT
OUTPUT--sport
Delete old entries:
#iptables-D input/output 6
Note:
If the port involved in the firewall entry is already defined in Linux, it will not be convenient to view through IPTABLES-L when it is operational, and you need to modify/etc/services.
#iptables-F (empty firewall)
#/etc/init.d/iptables Save (Save config)
Vii. system Time
#date (view)
Manual modification:
#date-S 2016/07/08
#date-S 16:54:00
Time Server auto-sync:
#ntpdate 192.168.1.1
#vi/etc/crontab (Add a scheduled Task)
0-59/10 * * * */usr/sbin/ntpdate 192.168.1.1
#crontab restart
Eight, configure the Yum source
/etc/yum.repos.d/(Yum source configuration file location)
① comes with Yum source (no configuration required, system comes with it)
② external yum source (such as 163yum source, download the configuration file in the above directory can be placed)
③ local Yum source (. iso file or external DVD, you need to mount it to a file directory, and then modify the configuration file)
To modify a configuration file:
[Rhel-debuginfo]
name=red Hat Enterprise Linux $releasever-$basearch-debug
Baseurl=file:///mnt/cdrom/server
Enabled=1
Gpgcheck=0
How to use the Yum Source:
#yum grouplist (Get a list of Yum sources)
#yum install XXXX (download)
#yum Update XXXX (updated)
Ix. installing VMware Tools (virtual machine environment)
#tar zxvf vmwaretools ....-c/root/
After entering the extracted directory, execute the following command
#./vmware-install.pl
With the above configuration, a Linux-based server infrastructure configuration is basically complete.
This article is from the "Little Kantong" blog, please make sure to keep this source http://rni1990.blog.51cto.com/6663894/1812716
Linux Basic Environment Preparation