Linux system optimization

Source: Internet
Author: User
Tags i18n

1th Linux System Optimization 1.1 viewing the version of the system
[Email protected] oldboy]# cat/etc/redhat-6.9 (Final)

1.1.1 Kernel version + 64-bit
[Email protected] oldboy]# uname-R2.6. -696. el6.x86_64                  kernel version bit 2.  6.32[[email protected]- oldboy]# uname-mx86_64

1.2 Create add normal user
[Email protected]  oldboy]# useradd oldboy        Add a user named Oldboy [email protected]-  oldboy]# passwd Oldboy         is too simplistic/systematic       are   too                    simple You can ignore retype new password:                            Enter the password again passwd:all authentication tokens updated successfully. (successful)     password Setup succeeded

1.2.1 Use this user
[[email protected] /]# Su- oldboy               Switch User [[email protected]-+  ~]$ whoami              Shows which user is currently under Oldboy

1.3 Turn off SELinux function

First Milestone-permanently off SELinux Modify SELinux profile #enforcing selinux default status SELinux already on running #permissive SELinux temporarily off display warning #disabled Selin UX completely closed [[email protected]- +~]# cat/etc/selinux/config look at the contents of the document # This file controls the state of SELinux on the s# selinux=Can take one of these three values:# enforcing-SELinux Security Policy isenfor# Permissive-SELinux Prints Warnings instead# disabled-No SELinux Policy isloaded. SELINUX=enforcing# Selinuxtype=Can take one of these values:# targeted-targeted processes is protected,# MLS-Multi level Security protection. Selinuxtype=targeted [[email protected]- +~]# SED's#selinux=enforcing#selinux=disabled#g'/etc/selinux/Config View modify replacement configuration information # This file controls the state of SELinux on the system.# selinux=Can take one of these three values:# enforcing-SELinux Security Policy isenforced.# Permissive-SELinux Prints warnings instead of enforcing.# disabled-No SELinux Policy isloaded. SELINUX=disabled# Selinuxtype=Can take one of these values:# targeted-targeted processes is protected,# MLS-Multi level Security protection. Selinuxtype=targeted [[email protected]- +~]# Sed-i's#selinux=enforcing#selinux=disabled#g'/etc/selinux/config to modify the replacement configuration information [[email protected]- +~]# grep"selinux= "/etc/selinux/config whether the query was changed successfully# SELINUX=Can take one of these three values:selinux=disabled## #selinux配置文件生效--you need to restart the server #不要给自己找任何理由重启服务器第二个里程碑--temporarily close SELinux1. # # #查看selinux是否正在运行 [[email protected]- +~]# getenforceenforcing SELinux is running2. Temporary closure Selinux[[email protected]- +~]# Setenforceusage:setenforce [Enforcing | Permissive | 1|0] 1 is run 0 is off [[email protected]- +~]# Setenforce0[[Email protected]- +~]# getenforcepermissive Summary: How to close SELinux permanently close SELinux/etc/selinux/config temporarily shuts down SELinux setenforce

1.4 Shutting down the firewall iptables

# # # #防火墙--------equivalent to the Guard guard in our building

# # #工作中如何使用 When to turn off the firewall

    1. Everyone in the building's doorway can get in and out. Servers allow users to use (worldwide) to open firewalls
    2. Internal classroom door Staff student teachers access not to open the fence
    3. When you start learning Linux, you also close the firewall.
    4. Close when high concurrent traffic is large
1.4.1 Querying whether a firewall is running
[[Email protected] +~]#/etc/init.d/iptables statustable:filterchain INPUT (policy ACCEPT) num Target prot opt source destination 1ACCEPT All--0.0.0.0/0            0.0.0.0/0State related,established2ACCEPT ICMP--0.0.0.0/0            0.0.0.0/0          3ACCEPT All--0.0.0.0/0            0.0.0.0/0          4ACCEPT TCP--0.0.0.0/0            0.0.0.0/0StateNEWTCP DPT: A5    REJECTAll--0.0.0.0/0            0.0.0.0/0Reject-with icmp-host-prohibited Chain FORWARD (policy ACCEPT) num Target prot opt source destination1    REJECTAll--0.0.0.0/0            0.0.0.0/0Reject-with icmp-host-prohibited ChainOUTPUT(policy ACCEPT) num Target prot opt source destination

1.4.2 temporarily shut down the firewall
[Email protected] ~]# /etc/init.d/iptables stopiptables:setting chains to policy Accept:filter                                                [ C3/>ok  ]iptables:flushing Firewall rules:              [  OK  ]iptables:unloading modules:                    [  OK  ][[ Email protected]- ~]#/etc/init.d/iptables stop[[email protected]-~]# /etc /init.d/iptables  is not running.

1.4.3 permanently closed iptables
#让iptables防火墙 does not start when booting [[email protected]- +~]# chkconfig |grep iptiptables0: Off1: Off2: On3: On4: On5: On6: Off[[email protected]- +~]# chkconfig iptables off[[email protected]- +~]# chkconfig |grep iptiptables0: Off1: Off2: Off3: Off4: Off5: Off6: Off[[email protected]- +~]#/etc/init.d/iptables status Check iptables state Iptables:firewall is  notRunning.

1.5 Linux Chinese display settings (how to prevent the display of Chinese characters garbled)

What is a character set?

Common Character Set UTF-8

How to view character set variables in

Query the character set used by the current system

[Email protected]  ~]# echo $LANGen _us. UTF-8

LANG environment variable

    1. The name is uppercase.
    2. Can be used in most corners of the system
1.5.1 temporarily modifies the system's language and character set
[Email protected] ~]# export LANG=ZH_CN. utf-8     Modify Character Set [[email protected]-  ~]# echo $LANG                  view character set ZH_CN. UTF-8

Setup will display in Chinese after modification

1.5.2 permanently change the language and character set of the system
[Email protected] ~]# cat/etc/sysconfig/I18nlang="en_US. UTF-8 "sysfont="Latarcyrheb-sun16 "

Will lang= "en_US. UTF-8 "modified into lang=" ZH_CN. UTF-8 "is a modified character set

1.5.3 Effective
source/etc/sysconfig/i18n

1.5.4 Chinese display garbled reason

The charset of the system is different from the character set of the Echo $LANG and remote connection software (Xshell)

Workaround:

Modify the character set of the remote connection software (Xshell)

Modifying the character set of a Linux system 1. Temporary entry into force: Export lang= The word set to be modified

2. Permanent: Modify the lang= "en_US in the/etc/sysconfig/i18n file. UTF-8 "

Modify it to take effect source/etc/sysconfig/i18n

The system version used in this blog post is: The CentOS release 6.9 (Final) kernel version: 2.6.32-696.10.1.el6.x86_64 Linux is continuing to learn

Linux system 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.