[LINUX] Server setting tips Reverse lookup

A memo describes how to set up a common server (based on CentOS 6)

Set the IP address

Set with vim /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE="eth0"
IPADDR="10.2.0.58" <=Change this part (line)
NETMASK="255.255.255.0"
GATEWAY="10.2.0.1"
ONBOOT="yes"
TYPE="Ethernet"

Set the default gateway

The default gateway is the gateway to the Internet from the server (Usually a router). / etc / sysconfig / network-scripts / ifcfg-eth0 file Edit the GATEWAY line of. A network restart is required after the change. /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE="eth0"
IPADDR="10.2.0.58"
NETMASK="255.255.255.0"
GATEWAY="10.2.0.1" <=Edit this line
ONBOOT="yes"
TYPE="Ethernet"

Change the host name

Edit the HOSTNAME line in the / etc / sysconfig / network file. Hoss After changing the name, you need to restart the system. '/etc/sysconfig/network'

NETWORKING=yes
Edit this line
HOSTNAME=www.example.com

Enable / disable SELinux

Disable access control by SELinux by all means in server test etc. If you want to, "SELINUX = permissive" in the / etc / sysconfig / selinux file will do. A warning will be issued, but SELinux access control will be disabled. After changing the settings, reboot the system. /etc/sysconfig/selinux

SELINUX=permissive

To enable it, set "SELINUX = enforcing". /etc/sysconfig/selinux

SELINUX=enforcing

Set up a DNS server

The DNS server referenced by the server is in the /etc/resolv.conf file. Edit the nameserver line. The server belongs to the search line of the first line Enter the domain name (it does not have to be). /etc/resolv.conf

search example.com
nameserver 10.124.163.4 <=Edit this line
nameserver 10.124.163.3 <=Edit this line

Set language

To set the language displayed on the server, / etc / sysconfig / i18n) Specify as "LANG =" Locale "" in Isle. What is a locale? It is a unit that expresses or region, "C" in the case of English environment, and'Ja. In the case of Japanese environment. Specify "JP.UTF-8". On the server, to prevent garbled characters It is a good idea to set it to "LANG =" C "" in the environment. Change will be logged next time It will be effective from the time of operation. /etc/sysconfig/118n

LANG="C"
SYSFONT="latarcyrheb-sun16" <=Edit this line

Reboot the network

If you change the network settings, you need to restart the network.

[[email protected] ]# service network restart

Find out the IP address assigned to the server

Execute the ifconfig command. The "inet addr:" part on the second line is the server IP address.

[[email protected] ~]# ifconfig
etho
Link encap:Ethernet HWaddr 52:54:05:01:82:84
inet addr:10.2.0.58
Bcast:10.2.0.255
Mask:255.255.255.0
inet6 addr: fe80::5054:5ff:fe01:8284/64 Scope:Link
Metric:1
MTU:1500
UP BROADCAST RUNNING MULTICAST
RX packets:49298416 errors:0 dropped:0 overruns:0 frame:0
TX packets:73616594 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:3808917908 (3.5 GiB) TX bytes:108033988984 (100.6 GiB)
・
・
・

Install the Apache web server

Install with the yum command. The package name is httpd.

[[email protected] ]# yum install httpd

Start the Apache web server

Start using the service command. The service name is httpd. start fee Instead, stop with stop and restart with restart.

Trootecentos -]# service httpd start

Reboot the system

Reboot with the -r option to the shutdown command. Instead of now, "+10. If you specify, it will restart after 10 minutes.

[[email protected] ~]# shutdown -r now

Shut down the system

Shut down the system with the -h option on the shutdown command.

[[email protected] ~]# shutdown -h now

Check the logged-in user

When the w command is executed, the logged-in user and the access source (FROM) are displayed. Will be displayed.

[[email protected] -]# w
23:00:03 up 7 days, 26 min, 1 user, load average: 0.00, 0.00, 0.00
USER   TTY   FROM                   [email protected]   IDLE   JCPU  PCPU WHAT
centuser     pts/058.80.227.149     22:48    0.00s  0.08s 0.03s  sshd: centuser

Create a user

Execute the useradd command with the user name specified.

[[email protected] -]# useradd webadmin

Delete user

Execute the userdel command with the user name specified. With -r option This will also delete the user's home directory.

[[email protected] -]# userdel -r webadmin

Change the root user password

Run the passwd command as the root user. Current password, new Enter your password twice.

[[email protected] ~]# passwd

Change the password of a general user

Execute the passwd command by specifying the general user whose password you want to change. I will. Enter the password twice.

[[email protected] ~]# passwd webadmin

Check open ports

Use the netstat command to display open ports and check which services are running. I can admit it.

[[email protected] ~]# netstat -atn

Update system

This command keeps the packages installed on your system up to date Will be updated to.

[[email protected] ~]# yum update

Disable SELinux

Temporarily disable SELinux access control.

[[email protected] ]# setenforce 0

Enable SELinux

Enables SELinux in the disabled state.

[[email protected] ]# setenforce 1

Recommended Posts

Server setting tips Reverse lookup
Sympy Reverse Lookup Reference
Pandas reverse lookup memo
Luigi Reverse Lookup Reference
Django admin screen reverse lookup memo