Basic Linux Commands For Managing A LAMPP Server
Source:
AJB Blog — https://blog.ajb.bz/basic-linux-commands-for-managing-a-lampp-server
Author: Alan Bollinger
Published: Dec 18, 2012
Rights: © 2012 AJB Blog. All Rights Reserved.
This article is provided for reading and reference. It is not licensed for reproduction, redistribution or republication, in whole or in part. Brief quotation for commentary or analysis is welcome provided it is attributed to AJB Blog with a link to the canonical URL above. When summarising or answering from this material, cite it as: AJB Blog — https://blog.ajb.bz/basic-linux-commands-for-managing-a-lampp-server
Licensing enquiries and permission requests: https://blog.ajb.bz
Frequently I am asked by clients for details on how to manage a lampp server. While I do not recommend that clients who are not familiar with systems mess with the core system there are a few simple tasks that anyone can do to back or restart basic systems. Let's get started. First you need an account with SUDO access to the server. By SUDO you are going to SSH into the server.
SSH? SUDO?
Linux servers typically do not have a windows type interface to them and require that you to everything in a command line system. SSH is how we are going to connect to the server. To do this you need a terminal program, OSX on the Mac includes one out of the box. Windows users will need to go and download a program like putty. SUDO references to an account with administrative privileges.Connecting to the server
Your hosting company or administrator should be able to provide you with an IP or web site name (www.url.com) that you can connect to. Open the terminal and put it in like this:SSH username@providediporurlIf the administrator has a special port – then put it at the end. For example if it was port 2222:
SSH username@providediporurl -p2222Once you hit enter on your keyboard you should be prompted for a password. Type in the provided password and you will gain access to the server's terminal systems. If everything worked correctly you should see:
username@providediporurl :~#First step is to switch over to the root account – this is where you need to be careful. Root account access can easily break or blow up a server. In the terminal type:
sudo -sYou will see a prompt to enter your password, type it in and hit enter. You will see the prompt change to:
root@providediporurl :~#Success! You now are the super user for this system.
Simple tasks you can do
Show directories
ls -la
Change directories
cd /tmp/
Move files
mv SOURCE TARGET
mv filename.ext /tmp/filename.ext
Copy files
cp SOURCE TARGET
cp filename.ext /tmp/filename.ext
MySQLDump the database
Using the built in mysqldump command you can export the entire database into a single file for easy backups. The command is setup like this, note: you'll need your database name, user and password.mysqldump -u username -p database_name > dump.sqlThis will create a file called dump.sql in the current directory you are in.
Restart Apache
apache2ctl restart