Centos 5.3 server configuration (III)

Source: Internet
Author: User
Tags gpg

Address: http://www.ondev.net/post/show/685

Edit/etc/hosts

Use VI to open/etc/hosts:

 

VI/etc/hosts

The content is similar to this:

# Do not remove the following line, or various programs
# That require Network functionality will fail.
127.0.0.1 localhost. localdomain localhost
192.168.0.100 server1.example.com server1
: 1 localhost6.localdomain6 localhost6

Generally, each hosts file acts as a host. Each line consists of three parts, separated by spaces. The line starting with # is not explained by the system.

Part 1: network IP address;

Part 2: Host Name or domain name;

Part 3: Host Name alias;

Of course, each line can also be two parts, namely the Host IP address and host name; for example

192.168.1.100 myhost100.

Here we can slightly explain the differences between the host name (hostname) and domain name (domain): The host name is usually used in the LAN. Through the hosts file, the host name is resolved to the corresponding IP address; the domain name is usually used on the Internet, but if the local machine does not want to use domain name resolution on the Internet, then you can change the hosts file and add your own domain name resolution.

Add another IP Address

(This part is optional. It is listed here to show how to add another IP address to centos after the first installation)

Assume that the NIC is configured as eth0, there should be a file like this:/Etc/sysconfig/network-scripts/ifcfg-eth0. We can use this file as the basis for modification:

CP/etc/sysconfig/network-scripts/ifcfg-eth0/etc/sysconfig/network-scripts/ifcfg-eth0: 0

If you need to configure the second IP address, the corresponding is the ifcfg-eth0: 1

Then edit the file:

VI/etc/sysconfig/network-scripts/ifcfg-eth0: 0

The content is roughly as follows:

# Intel Corporation 82545em Gigabit Ethernet controller (copper)
Device = eth0: 0
Bootproto = static
Broadcast = 192.168.0.255
Ipaddr = 192.168.0.101
Netmask = 255.255.255.0
Network = 192.168.0.0
Onboot = Yes

Generally, you only need to modify ipaddr. Then restart the network:

/Etc/init. d/network restart

You may also want to modify/etc/hosts, but this is not a required step.

Run ifconfig to see that the IP address of the new configuration takes effect.

Firewall Configuration

For the server, security is very important. For how to configure iptables, you can view this articleArticle:

Http://www.ondev.net/post/show/749

I will not go into detail here.

Install some useful software packages

First, import the GPG key of the software package:

Rpm -- import/etc/pki/rpm-GPG/RPM-GPG-KEY *

Then update some existing software:

Yum update

Then install some useful software:

Yum install fetchmail wget Bzip2 unzip zip NMAP OpenSSL Lynx fileutils ncftp GCC gcc-C ++

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.