Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Is there any way to download LAMP and save it to the HDD so next time if i install a newer Ubuntu i dont have to download it again ?
I just switched to Ubuntu today, is there anyway to save the EXE like we do it in Windows ?

The error:

Reading package lists... Done
Building dependency tree... 50%
Building dependency tree       
Reading state information... Done
Package gstreamer0.10-plugins-ugly is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'gstreamer0.10-plugins-ugly' has no installation candidate
sou@ubuntu:~$ 
sou@ubuntu:~$ sudo apt-get install apache2 mysql-server php5
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package apache2 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

Package mysql-server is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

Package php5 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'apache2' has no installation candidate
E: Package 'mysql-server' has no installation candidate
E: Package 'php5' has no installation candidate
share|improve this question

2 Answers 2

You can install the packages for a LAMP stack (the Linux part is Ubuntu; the other packages needed are Apache, MySQL and PHP). Because you're using a LAMP stack, you should become familiar with using a console since most servers do not have a GUI for administration at all. So, to install the packages Apache, MySQL and PHP, run:

sudo apt-get install apache2 mysql-server php5

The webroot is stored in /var/www by default, if you're doing a new installation, create a separate partition for /var/www (choose for custom partitioning in order to get the option for it). MySQL databases are stored in /var/lib/mysql, you can create a separate partition for it in the same way as you did for Apache.

Configuration files are put in /etc/, so backup those:

  • Apache (module config, vhost, ...): /etc/apache2/
  • MySQL (server settings and administration password for MySQL): /etc/mysql/
  • PHP (php.ini files): /etc/php5/

With those files you can setup an identical LAMP stack after a re-install.

A single command for creating a backup named "lamp-backup.tar.gz" of the config files, webroot an databases:

sudo tar cf lamp-backup.tar.gz /etc/{apache2,mysql,php5} /var/www /var/lib/mysql

For the best results, stop the database before creating the backup by running sudo stop mysql. After the backup, the database can be started again by running sudo start mysql.

To restore the previously made backup (on a fresh installation), run:

sudo tar xf lamp-backup.tar.gz -C /

Do not forget to install the packages too.

share|improve this answer
    
whenever i try to install PHP5 from the terminal it shows some error like package not found , i tried while connected to the internet ! –  Sourav Jul 2 '11 at 16:42
    
@Sourav: could you post the full error message? (if it's a large message, add it to your question). Run sudo apt-get update before installing –  Lekensteyn Jul 2 '11 at 20:19
    
check the error log –  Sourav Jul 3 '11 at 6:58
    
You seem to miss some repositories which might break other packages as well. Can you follow the instruction on askubuntu.com/q/26047/6969 to get a list of repos and add that information to your Q? –  Lekensteyn Jul 3 '11 at 8:36

Ubuntu uses packages instead of .exe files for programs. The packages are in the form of .deb files and are automatically downloaded when you install software through the software center or apt-get.

When you installed the LAMP software, you probably downloaded multiple .deb files--one for each program and library that was not already installed. So there's probably one for Apache, a few for PHP and its integration into apache, and a few for MySQL. Normally, it could be a chore to gather all these things on Windows. The reason for Ubuntu's package archive is to keep track of all these things and make sure that (1) when you install something, everything that is needed is also installed; and (2) you don't have multiple copies of the same things installed, and (3) everything is updated when there's an update.

Now, when Ubuntu's package system downloads a package to install, it caches a copy in /var/cache/apt/archives. You can look in there and copy the packages you want to save to a different drive if you wish. You can also put package files into /var/cache/apt/archives on a new install* and when you install software using software center, synaptic, or apt-get, the package will be used if it is the latest version available. I should point out that because of this caching, if you are reinstalling apache on the same install of Ubuntu, the packages will not be re-downloaded; the cached version will be used without you having to do any copying.

By the way, you can move to a new version of Ubuntu without reinstalling. The package management system comes to the rescue again. Ubuntu is made up of packages. So when you decide to go to a new version of Ubuntu, the package system downloads the newer versions of the packages that make up the system, and replaces the old version with the new versions. This leaves all your settings and user files intact.

*You need root user (equivalent of Window's Administrator user) privileges to do this. You can open a Nautilus window (equivalent of Windows Explorer) with root privileges by pressing Alt F2 and putting in gksudo nautilus, then pressing run and entering your password.

share|improve this answer
1  
Unless you've limited Internet access or a slow connection, I would not copy the files from /var/cache/apt/archives because those files can quickly become outdated. +1 for explanation of how the package system works compared to the download&install from windows. –  Lekensteyn Jul 3 '11 at 8:34

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.