Linux Small white-basic-system simple optimization

Source: Internet
Author: User
Tags i18n syslog rsyslog

As a just contact with the small white Linux, through a period of study, will be my own part of the notes to take out, to ask for guidance, because it is "0" basic learning from a lot of places do not know enough depth, I hope you can guide the predecessors, to the people rose, hand to leave the fragrance, thank you!

Because the conditions of the limited environment is built with VMS, the following is mainly based on the "Old boy education video" in the contents of the system simple optimization, I hope you have seen the future can give suggestions;

have been learning progress for the purpose, do not like to spray! Thank you!

System Simple Optimization command

< Span style= "Background-color:inherit;" > One, close selinux                              ( security measures (90% Enterprise closes the app) )                   

[Email protected]alvin~]# vi/etc/selinux/config

Selinux=disabled


Second, modify the boot mode (command line mode)

Vi/etc/inittab

[Email protected]alvin~]# id:3:initdefault:


Third, modify the hostname

[Email protected]alvin~]# vi/etc/sysconfig/network

Hostname=alvin

[Email protected]alvin~]#vi/etc/hosts

127.0.0.1 localhost Alviv localhost4 localhost4.localdomain4

:: 1 localhost localhost.localdomain localhost6 localhost6.localdomain6


Four, start-up optimization of the boot

sshd remote Services,Rsyslog system logs, network networking Services, Crond Scheduled Tasks

View Boot Startup items

[email protected] ~]# chkconfig--list|grep "3:on"

Turn off all boot entries

[[email protected] ~]# for Alvin in ' Chkconfig--list|grep ' 3:on ' |awk ' {print '} ';d o chkconfig $alvin off;done

Turn on the specified service boot

[[email protected] ~]#for Alvin in Crond network sshd rsyslog;do chkconfig $alvin on;done

Regular expression Simplification commands

[[email protected] ~]# for Alvin in ' Chkconfig--list|grep ' 3:on ' |awk ' {print '} ' |grep-ve ' Crond|network|sshd|r Syslog "';d o chkconfig $alvin off;done

Displays all boot entries in command line mode, then displays the names of all boot-up entries, grep-ve The specified option, and turns off the remaining options .Remove the system boot entry by reverse screenCrond,Network,sshd,Rsyslogafter the options are executed, the remaining options are closed

Knot: Streamlined Boot service (only Crond,sshd,network,rsyslog(CentOS5.8 is syslog )


V. Changing the remote service configuration

Configure the remote connection default port

[email protected] ~]# cd/etc/ssh/

Backup sshd_config files (avoid errors)

[email protected] ssh]# CP sshd_config Sshd_config.ori

[email protected] ssh]# VI sshd_config

#Port 22/value range from 0 to 65535

#PermitRootLogin no/No root user remote login no/yes, select No

#PermitEmptyPasswords no/No blank password login no/yes, select No

Remove the pre-configuration # number

After the modification is complete, restart the service

[email protected] ~]#/etc/init.d/sshd Reload


Vi. shutting down the firewall

[[email protected] ~]#/etc/init.d/iptables stop


Seven, user rights optimization

Root Login Visudo Edit

[Email protected] ~]# Visudo

For new users, you can use sudo to execute all root commands (note: The user password is required for each switchover)

Root all= (All) all

Alvin All= (All) all

Password free

Alvin All= (Root) Nopasswd:all

Eight, character set adjustment

[email protected] ~]# vi/etc/sysconfig/i18n

Lang= "ZH_CN. GB18030 "
Supported= "ZH_CN. GB18030:zh_CN:zh:en_US. Utf-8:en_us:en "
Sysfont= "Latarcyrheb-sun16"

Note: To avoid garbled output characters, the character set encoding and CRT Consistent Coding
Change character set, support Chinese, to prevent garbled suggestions continue to use the English character set,

Restart takes effect

[email protected] ~]# source/etc/sysconfig/i18n


Nine, time synchronization

Yum Installation Time Service

[email protected] ~]# yum Install ntp-y

Start the service

[email protected] ~]# Service ntpd Start

Boot up

[email protected] ~]# chkconfig ntpd on

View Port Operating Status

[email protected] ~]# NETSTAT-ANP |grep ntpd

Setting the time zone

[email protected] zoneinfo]# Vi/etc/sysconfig/clock

Zone= "Asia/shanghai"

Modification time

[email protected] ~]# date-s 20160825

[email protected] ~]# date-s 13:18

[[email protected] ~]# Date

Thursday, May 26, 2016 13:19:26 PDT

Sync bios Time

[email protected] ~]# clock-w


X. Yum Source Update

Backup

Mv/etc/yum.repos.d/centos-base.repo/etc/yum.repos.d/centos-base.repo.ori

Download the corresponding version repo file and put it in/etc/yum.repos.d/

Generate cache

Yum Clean All

Yum Makecache


11, Upload and download tools

[email protected] ~]# yum Install Lrzsz

SZ Download to local

RZ upload to Linux

12. Lock System Key files

[email protected] ~]# chattr +i/etc/passwd/etc/shadow/etc/group/etc/gshadow/etc/inittab

Unlock

[email protected] ~]#chattr-i/etc/passwd/etc/shadow/etc/group/etc/gshadow/etc/ Inittab//-i

Note: Lock system critical Files (passwd user file /shadow user password file /group user group file /gshadow Group password file /inittab each operation level landing) can be increased according to the actual needs of the file


This article is from the "Linux Small white" blog, please be sure to keep this source http://alvinzhao.blog.51cto.com/9702354/1783510

Linux Small white-basic-system simple optimization

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.