Install LAMP on Ubuntu

Yesterday i was  installing lamp on Ubuntu server .i thought of making a post which acts as future reference and has all the command i use .Well here is it .

This things work the same on Ubuntu or Ubuntu server .

First update system packages and repositeries
sudo apt-get update && sudo apt-get upgrade
 
you can install LAMP in one Command
sudo apt-get install lamp-server^
 
Install Apache
sudo apt-get install apache2 libapache2-mod-php5
 
Install MySQL
sudo apt-get install mysql-server mysql-client
 
Install PHP5
sudo apt-get install php5 libapache2-mod-php5
 
Install NGINX
sudo apt-get install nginx
Start Nginx by this command
sudo service nginx start
 
Install PhpMyAdmin
sudo apt-get install phpmyadmin
Choose Apache if you need to edit the config file Manually 
sudo nano /etc/dbconfig-common/phpmyadmin.conf
 
Install Webmin
sudo nano /etc/apt/sources.list
At Bottom add this two lines
deb http://download.webmin.com/download/repository sarge contrib
deb http://webmin.mirror.somersettechsolutions.co.uk/repository sarge contrib
 
then run thes cmds
wget http://www.webmin.com/jcameron-key.asc
sudo apt-key add jcameron-key.asc
Update the sources list
sudo apt-get update
now Install Webmin
sudo apt-get install webmin
When Finished you get webmin by http://localhost:10000/ (or if on a network) http://your-server-ip:10000/
 
Install BMON – Simple CLI Bandwidth Monitor
sudo apt-get install bmon
you can run it by
bmon
 
 
Other handy commands
Download files
wget http://example.com/file.zip
Change password
sudo passwd ubuntu
edit php.in file
sudo nano /etc/php5/apache2/php.ini
Restart Apache
sudo /etc/init.d/apache2 restart
set Recursive Permissions for your websites directory
sudo chmod -R 775 /var/www/
cd /var/www/ sudo chmod -R www-data:www-data directoryname
 
block an ip address
Single ip
sudo iptables -I INPUT -s 192.168.100.1 -j DROP 
ip range
sudo iptables -I INPUT -s 192.168.100.0/24 -j DROP
 
Managing packages
sudo apt-get update && sudo apt-get upgrade
sudo apt-get autoremove