Ubuntu Zero to Hero Ubuntu Zero to Hero | Page 19

Install, update and remove packages If you're looking to manage your Ubuntu servers effectively, you'll probably want to install some management software (such as Ajenti). You can do this through the Ubuntu package management system. The package management system is a derivative of that used in Debian Linux, whereby each package will contain all of the required files, data and instructions to deploy a new piece of software to your system. The process to install and upgrade software will vary, depending on what you're trying to install, however the commands available to you through the Ubuntu terminal are always the same and are outlined below. DPKG The first command is dpkg – this particular package can help you to install or remove software from your Ubuntu OS, however, it will not automatically download and install dependencies that your software many have (for example Wordpress is dependent on MySQL). This tool is therefore best used for those packages that are local to your machine. Command Description Dpkg -l This command lists all of the packages that are currently installed on your system. Dpkg -l | grep apache2 To find out if a specific package is installed (without trawling through the entire list of installed packages), you'll want to use the grep function. This lets you search for a specific package name (in this case Apache) Dpkg -L apache2 This particular function lists all of the files which are installed by a package. Dpkg -S This command will tell you which package installed a particular file. For example dpkg -S /var/www/config.conf The output of this command will show you what package the file 'config.conf' belongs to. Sudo dpkg -i filename.deb If you've downloaded a .deb package file to your system, you can use this command to install it. Sudo dpkg -r packagename While it is not recommended that you use dpkg to remove packages (because it will not manage dependencies), you can do do it. www.netshock.co.uk