Ive been playing around recently with Centos 6.3, over this time as I a Microsoft man Ive struggled to do the most basic of things so as I go along I thought I would compile a list of simple commands.
How do I update Centos?
update
How do I install Apache in Centos?
yum install httpd
How do I set Apache to start on boot in Centos?
chkconfig –-levels 235 httpd on
How do I install MySQL in Centos?
yum install mysql mysql-server
How do I get MySQL to start at boot in Centos?
chkconfig –-levels 235 mysqld on
How do I Secure my MySQL install in Centos?
mysql_secure_installation
Then run through the basic configuration accepting the defaults such as removing the guest accounts and passwords.
How do I restart MySQL in Centos?
service restart mysqld
How do I install PHP in Centos?
yum install php
How do I restart the Apache service in Centos?
Service httpd restart
How do I list a directory in Centos?
find
How do I locate a specific file in a directory in Centos?
find . -name FILENAME
How do I locate a file with a certain word in it in Centos?
Lets say you wanted to find a file that had the word log in it.
locate log
How do I restart IPTables in Centos?
service iptables restart
How do I flush the cache of my IPTables in Centos?
iptables -f
How do I see what services are running and their status under Centos?
top
and to exit CTRL+X. This service will give you information on what CPU usage and memory usage is being used for a given service.
How do I list in order what service is using the most memory in Centos?
ps -eo pcpu,pid,user,args | sort -k 1 -r | head -10
How do I change the name of my server in Centos?
hostname yourchosenservername
How do I create a new user in Centos?
adduser thentheusername
How do I change the password for the user I am logged in as in Centos?
passwd
How do I edit files in Centos? I presonally use Nano, so lets first install it.
yum install nano
Then if we want to edit a file with nano. We use nano command then the path to the file, for exampl here we edit the file allen.log in etc.
nano /etc/allen.log
Can I put graphical Interface on Centos to manage all of this?
Yes you can, I recommend Webmin, its simple to install and it is a free alternative to cpanel it also offers auto updates. How do I install Webmin on Centos? First download it like this.
wget http://prdownloads.sourceforge.net/webadmin/webmin-1.620-1.noarch.rpm
Then install Webmin with the following command.
rpm -Uvh webmin-1.620-1.noarch.rpm
You will see after the install the path to your new shiny Webmin control panel. It is normally IPAddress:10000
How do I stop,start and restart Webmin on Centos?
/etc/init.d/webmin start /etc/init.d/webmin stop /etc/init.d/webmin restart /etc/init.d/webmin status
How Do I Clear The Screen in Centos
Clear
or
ctrl+l
or
reset