Linux Basic optimization

Source: Internet
Author: User

Now the production environment of the machine is basically more than 4G of hardware environment, we choose the operating system when it must be X64-bit system,

When downloading the system, be careful to download the DVD version,


LINUX cannot be created without less (/root partition swap boot) machines in production environment

Swap partition is generally 1-2 times the memory (more than 16G of the server basically 8-16g swap space is enough for the rest is not much use, swap partitions can be installed in the system after the increase in adjustment)


General partitions

/remaining hard disk size swap 1.5 times x/boot 100M


DB and storage with large amounts of data

/data/remaining hard drive size (to prevent loss of data from reloading system)/50-200gswap 1.5/boot 100M


Portal Big Website

/50-200gswap 1.5/boot 100M not reserved in partition future that needs to be flexible to use according to your own needs


The following partition is free to divide.

/usr/home/var


Production environment server as far as possible with hard RAID,LVM and soft raid is not very stable, the data is very important, must not be greedy for a small amount of money lost data, then it is not a hard raid can be solved, and now a lot of servers have hard RAID board


viewing system version Information

[Email protected] ~]# cat/etc/redhat-release CentOS release 6.5 (Final)


To view system details

[Email protected] ~]# uname-alinux localhost.localdomain 2.6.32-431.el6.x86_64 #1 SMP Fri Nov 03:15:09 UTC x86_6 4 x86_64 x86_64 Gnu/linux


View Kernel version

[Email protected] ~]# uname-r2.6.32-431.el6.x86_64


View number of digits

[Email protected] ~]# uname-mx86_64

Look at the devices on Linux that are located on the device name.

The devices are under/dev

IDE interface/DEV/HDASCSI interface/dev/sda[[email protected] ~]# LL/DEV/SD*BRW-RW----. 1 root disk 8, 0 Jan 2 03:09/dev/sdabrw-rw----. 1 root disk 8, 1 Jan 2 03:09/DEV/SDA1BRW-RW----. 1 root disk 8, 2 Jan 2 03:09/DEV/SDA2BRW-RW----. 1 root disk 8, 3 Jan 2 03:09/dev/sda3


Modify Host Name

[[email protected] ~]# hostname web-172.16.13.143 (temporary entry into force login) [[email protected] ~]# Cat/etc/sysconfig/networknetworki ng=yeshostname=web-172.16.13.143


View current user (who I am)

[Email protected] ~]# WhoAmI root


Create user

[[email protected] ~]# useradd user Password change (without username, modify current user) [[email protected] ~]# passwd User (password to enter two times) changing password fo R User User. New Password:bad Password:it is too simplistic/systematic (hint password too simple, we test, no need to be so complicated) bad Password:is too simpleretype new P  Assword:passwd:all authentication tokens updated successfully. (This word is OK, the description is completed)


You can use this when you change the user password in bulk.

[Email protected] ~]# echo "123456" | passwd--stdin userchanging password for user User.passwd:all authentication tokens updated successfully.

Switch users

# Super Admin prompt $ normal user prompt [[email protected] ~]# su-user[[email protected] ~]$ whoamiuser[[email protected] ~]$ su-root (switch ro OT need password, root switch other users do not, ordinary user switch Ordinary user also need password) Password: [[email protected] ~]$ exit (exit User) Logout[[email protected] ~]#



View history-Executed commands

[Email protected] ~]# history 422 useradd user 423 passwd user 424 echo "123456" | passwd--stdin User 425 su-user 426 history [[email protected] ~]# history-d 424 (Delete a row of information) 422 Useradd user 423 P ASSWD User 424 Su-user 425 historical 426 history-d 424 427 History [[email protected] ~]# history-c (delete all history) [[ Email protected] ~]# history 1


Yum Software management can install the uninstall software (the proposed installation of the system, replaced by their own source, or 163, Ali, Sohu, etc., install the software will soon)

[[email protected] ~]# yum-y install wget# (wget command is the tool used to download things) # (some people yum error, see if you can connect to the Internet, or if the current user is using Yum installation privileges)


SELinux disabled, this software is very powerful, but will not use the later very miserable, do everything to intercept, nosy to disable

[[email protected] ~]# vi/etc/selinux/config selinux=enforcing (enforcing changed to disabled) restart effective [[email protected] ~]# sed-i s #SELINUX =enforcing#selinux=disabled#g/etc/selinux/config (shortcut)


Toggle Level

[[email protected] ~]# runlevel (view run level) N 3[[email protected] ~]# init 5 (desktop) [[email protected] ~]# init 6 (restart)



Boot Management

View the 3;on process in the startup process

[Email protected] ~]# Chkconfig--list | grep "3:on" Grep-ve "AA|BB|CC" can be multiple filters [[email protected] ~]# Chkconfig--list | grep "3:on" |grep-ve "Sshd|network|crond|rsyslog"


Author Personal blog: www.021soso.com

Baidu Cloud Disk Search: http://pan.yunpanos.com (Always use the search video tutorial site, so recommend to everyone)




This article is from "a Pierce Arrow" blog, please be sure to keep this source http://centos2015.blog.51cto.com/9880217/1730752

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