Basic Linux configuration (2)

Source: Internet
Author: User
Tags i18n rsync

1. Create a user
Useradd RedHat
Passwd RedHat
In this way, a user with the username RedHat and password RedHat is created. The default Redhat group is used. The RedHat Directory folder is automatically created in the home directory to store the user's data. The directory permission is 700.

Use the RedHat user to log on to the system and enter the command LS-a to view the following file:
. Bash_logout: script executed when the user exits the system.
. Bash_profile,. bashhrc: any user enters the system's initialization file and initializes the user environment.

Ii. User System directory:
Bin: binary file, required by the system,ProgramTool. Commands run by users, such as LS and Dir.
Boot: A required file for system startup, including the kernel, boot program configuration file, and disk image file.
Dev: directory of system devices, peripherals, disks, and terminal devices.
ETC: directory where all system configuration files are stored. All system configuration parameters are stored here.
Home: directory for storing common user files. All user directories are stored here.
Initrd: a temporary directory, which is used during boot initialization.
Lib: Shared Library, library files of executable programs
Lost + found: fragment file found during system self-check.
Misc: Extra files, messy files.
MNT: directory for mounting external devices
OPT: It is null by default and is generally used for installing large software.
Proc: Virtual File System that reflects kernel process information and does not occupy any hard disk space
Root: Administrator's home directory
Sbin: Super Users must use basic management tools to use the management tool directory. Generally, only Administrators can use it.
TMP: temporary directory, which can be written globally. each user has a directory.
USR: common configuration materials, tools, and documents for all users.
VaR: dynamically changed data, including system logs

The VaR and home sizes are constantly changing.

3. Use DF to view partition usage in the current system.
example:
[RedHat @ server RedHat] $ DF
filesystem 1k-blocks used available use % mounted on
/dev/hda7 10080488 697064 8871356 8%/
/dev/ hda9 497829 8239 463888 2%/OPT
none 123592 0 123592 0%/dev/SHM

[RedHat @ server RedHat] $ DF-H
filesystem size used avail use % mounted on
/dev/hda7 9.7g 681 M 8.5g 8%/< BR>/dev/hda9 487 M 8.1 m 454 M 2%/OPT
none 121 M 0 121 m 0%/dev/SHM

Iv. view directory usage using du
[Root @ server root] # Du-SH /*
4.7 m/bin
5.2 m/boot
420 K/dev
5.9 m/etc
24 k/home
4.0 K/initrd
50 m/lib
16 K/lost + found
4.0 K/Misc
12 k/mnt
13 K/OPT
Du: '/proc/3719/FD/4': no such file or directory
141 K/proc
56 K/root
12 m/sbin
4.0 K/tmp
555 m/usr
17 m/var

5. Use fdisk to view Hard Disk Partitions
[Root @ server root] # fdisk-L/dev/hda

Disk/dev/hda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 Cylinders
Units = cylinders of 16065*512 = 8225280 bytes

Device boot start end blocks ID system
/Dev/hda1*1 1305 10482381 7 HPFs/NTFS
/Dev/hda2 1306 9728 67657747 + F Win95 ext 'd (LBA)
/Dev/hda5 1306 3916 20972826 7 HPFs/NTFS
/Dev/hda6 3917 6527 20972826 7 HPFs/NTFS
/Dev/hda7 6528 7802 10241406 83 Linux
/Dev/hda8 7803 7900 787153 + 82 Linux swap
/Dev/hda9 7901 7964 514048 + 83 Linux

Hdparm/dev/hda check whether the hard disk supports DMA
[Root @ server root] # hdparm/dev/hda

/Dev/hda:
Multcount = 16 (on)
Io_support = 0 (default 16-bit)
Unmaskirq = 0 (off)
Using_dma = 1 (on)
Keepsettings = 0 (off)
Readonly = 0 (off)
Readahead = 8 (on)
Geometry = 9729/255/63, sectors = 156301488, start = 0

Enable DMA support:
[Root @ server root] # hdparm-D1/dev/hda

/Dev/hda:
Setting using_dma to 1 (on)
Using_dma = 1 (on)

/Etc/rc. Local
The script file initialized by the system and the task commands automatically executed during system initialization must be written to this file. Provided to the Administrator and customized by the Administrator.

Vi. configure network parameters
1./etc/resolv. conf Save the default domain name DNS server of the system
2. ifconfig checks the IP Address Configuration and prints the network interface configuration information by default.

[root @ server root] # ifconfig
eth0 link encap: Ethernet hwaddr 00: 0C: 76: F9: CB: Ea
Inet ADDR: 10.0.5.20.bcast: 10.0.5.255 mask: 255.255.255.255.0
up broadcast running Multicast MTU: 1500 Metric: 1
RX packets: 5807 errors: 0 dropped: 0 overruns: 0 frame: 0
TX packets: 548 errors: 0 dropped: 0 overruns: 0 carrier: 0
Collisions: 0 txqueuelen: 100
RX Bytes: 426096 (416.1 KB) TX Bytes: 69732 (68.0 KB)
interrupt: 11 base address: 0xf000

Lo link encap: local loopback
Inet ADDR: 127.0.0.1 mask: 255.0.0.0
Up loopback running MTU: 16436 Metric: 1
RX packets: 20 errors: 0 dropped: 0 overruns: 0 frame: 0
TX packets: 20 errors: 0 dropped: 0 overruns: 0 carrier: 0
Collisions: 0 txqueuelen: 0
RX Bytes: 1540 (1.5 kb) TX Bytes: 1540 (1.5 kb)
3. Configure the IP address and gateway in netconfig
Service Network restart
4. Route-n
Ifconfig eth0 10.0.5.20.netmask 255.255.255.0
Route add default GW 10.0.5.138

Ifconfig and route do not save the parameter file, and disappear after the system is restarted. They are only used to debug network environment hygiene.

/Etc/sysconfig/network-scripts/network configuration script and file directory

[Root @ server root] # Cat/etc/sysconfig/network-scripts/ifcfg-eth0
Device = eth0
Onboot = Yes
Bootproto = static
Ipaddr = 10.0.5.20.
Netmask = 255.255.255.0
Gateway = 10.0.5.254

Service Network restart: Save the modified parameters.

Ls/etc/sysconfig/networking
Devices profiles
You can use netconfig | neat or RedHat-config-Tui to set
The configuration in takes effect first. If the parameters are set first, the network reads the parameters first, and the parameters of/etc/sysconfig/network-scripts/ifcfg-eth0 after netconfig are invalid.

 

5. RedHat-config-system command

VII. system user environment Configuration
1. System Language Environment -- locale
[Root @ server root] # locale
Lang = en_US.UTF-8
Lc_ctype = "en_US.UTF-8"
Lc_numeric = "en_US.UTF-8"
Lc_time = "en_US.UTF-8"
Lc_collate = "en_US.UTF-8"
Lc_monetary = "en_US.UTF-8"
Lc_messages = "en_US.UTF-8"
Lc_paper = "en_US.UTF-8"
Lc_name = "en_US.UTF-8"
Lc_address = "en_US.UTF-8"
Lc_telephone = "en_US.UTF-8"
Lc_measurement = "en_US.UTF-8"
Lc_identification = "en_US.UTF-8"
Lc_all =

Lang = en_US.UTF-8 represents the UTF-8 encoding of English, Lang represents the region environment settings, en-represents the language is English, US represents the region, character set represents the UTF-8 format.
Use locale-a to view the Supported languages;

Lang = zh_cn.gb2312

The language environment settings are saved in a configuration file/etc/sysconfig/i18n.
[Root @ server root] # Cat/etc/sysconfig/i18n
Lang = "en_US.UTF-8"
Supported = "en_US.UTF-8: en_us: en" # support for other environment Encoding
Sysfont = "latarcyrheb-sun16" # default font name

[Root @ server root] # ls/etc/sysconfig
Apmd devlabel i18n kudzu PCMCIA xinetd
APM-scripts GPM init mouse rawdevices
Authconfig grub installinfo network RHN
Clock harddisks IrDA networking sendmail
Console hwconf keyboard network-scripts Syslog
The configuration files of most server system startup initialization scripts are stored here, the most basic configuration information
For example,/etc/sysconfig/hwconf stores the hardware information checked by the system hardware Checker (kudzu. Use
[Root @ server root] # service kudzu start
Checking for new hardware # Check new hardware
Kudzu script for Automatic startup
Modify the service script when the system starts: chkconfig scriptname -- list
[Root @ server root] # chkconfig kudzu -- list
Kudzu 0: off 1: off 2: off 3: On 4: On 5: on 6: Off
List System services: chkconfig -- list | more
[Root @ server root] # chkconfig -- list | more
Kudzu 0: off 1: off 2: off 3: off 4: On 5: on 6: Off
Syslog 0: off 1: off 2: On 3: On 4: On 5: on 6: Off
Netfs 0: off 1: off 2: off 3: On 4: On 5: on 6: Off
Network 0: off 1: off 2: On 3: On 4: On 5: on 6: Off
Random 0: off 1: off 2: On 3: On 4: On 5: on 6: Off
Rawdevices 0: off 1: off 2: off 3: On 4: On 5: on 6: Off
PCMCIA 0: off 1: off 2: On 3: off 4: On 5: on 6: Off
Saslauthd 0: off 1: off 2: off 3: off 4: off 5: off 6: Off
Keytable 0: off 1: On 2: On 3: On 4: On 5: on 6: Off
Apmd 0: off 1: off 2: On 3: On 4: On 5: on 6: Off
ATD 0: off 1: off 2: off 3: On 4: On 5: on 6: Off
GPM 0: off 1: off 2: On 3: On 4: On 5: on 6: Off
Autofs 0: off 1: off 2: off 3: On 4: On 5: on 6: Off
Iptables 0: off 1: off 2: On 3: On 4: On 5: on 6: Off
IRDA 0: off 1: off 2: off 3: off 4: off 5: off 6: Off
ISDN 0: off 1: off 2: On 3: off 4: On 5: on 6: Off
Sshd 0: off 1: off 2: On 3: On 4: On 5: on 6: Off
Portmap 0: off 1: off 2: off 3: On 4: On 5: on 6: Off
NFS 0: off 1: off 2: off 3: off 4: off 5: off 6: Off
Nfslock 0: off 1: off 2: off 3: On 4: On 5: on 6: Off
Sendmail 0: off 1: off 2: On 3: On 4: On 5: on 6: Off
Rhnsd 0: off 1: off 2: off 3: On 4: On 5: on 6: Off
Crond 0: off 1: off 2: On 3: On 4: On 5: on 6: Off
Anacron 0: off 1: off 2: On 3: On 4: On 5: on 6: Off
Xinetd 0: off 1: off 2: off 3: On 4: On 5: on 6: Off
Start in the/etc/init. d directory
Xinetd based services:
Chargen-udp: Off
Rsync: Off
Chargen: Off
Daytime-udp: Off
Daytime: Off
Echo-udp: Off
Echo: Off
Services: Off
Servers: Off
Time-udp: Off
Time: Off
Sgi_fam: On

Started in the/etc/xinetd. d directory
[Root @ server root] # chkconfig rsync on

View system running level
[Root @ server root] # ls-L/etc/rc. d
Total 64
Drwxr-XR-x 2 root Root 4096 May 8 init. d
-Rwxr-XR-x 1 Root 2338 Feb 19 2003 RC
-Rwxr-XR-x 1 Root 220 Jul 11 2001 RC. Local
-Rwxr-XR-x 1 Root 23299 Feb 25 2003 RC. sysinit
Drwxr-XR-x 2 root Root 4096 May 8 rc0.d
Drwxr-XR-x 2 root Root 4096 May 8 rc1.d
Drwxr-XR-x 2 root Root 4096 May 8 rc2.d
Drwxr-XR-x 2 root Root 4096 May 11 rc3.d
Drwxr-XR-x 2 root Root 4096 May 8 rc4.d
Drwxr-XR-x 2 root Root 4096 May 8 rc5.d
Drwxr-XR-x 2 root Root 4096 May 8 rc6.d
View system running level
[Root @ server root] # runlevel
[Root @ server root] # More/etc/inittab
#
# Inittab this file describes how the INIT process shocould set up
# The system in a certain run-level.
#
# Author: Miquel van smoorenburg <miquels@drinkel.nl.mugnet.org>
# Modified for RHS Linux by Marc Ewing and Donnie Barnes
#

# Default runlevel. The runlevels used by RHS are:
#0-halt (do not set initdefault to this)
#1-Single User Mode
#2-multiuser, without NFS (the same as 3, if you do not have networking)
#3-full multiuser Mode
#4-unused
#5-X11
#6-Reboot (do not set initdefault to this)
#
ID: 3: initdefault:

# System initialization.
Si: sysinit:/etc/rc. d/rc. sysinit

L0: 0: Wait:/etc/rc. d/RC 0

/Etc/inittab system running level and script startup running level Configuration File Information

ntsysv system service configuration tool

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.