Install and update packages using the APT-GET command in Linux

Home > Search > Linux commands
  by

The apt-cache command can be used to locate a package.


INSTALL

Use the install option to install or update a package.

[root@server1 ~]# apt-get install package_name

 

To install a specific version of a package, add an equal sign followed by the version of the package.

[root@server1 ~]# apt-get install package_name=1.0.11-1

 

The -f option is commonly used, to ensure all package dependencies are installed. For a complete list of available options, refer to the apt-get man page.

[root@server1 ~]# apt-get install -f package_name

 


UNINSTALL

Use the remove option to uninstall a package, but do not remove the configuration files.

[root@server1 ~]# apt-get remove package_name

 

Use the purge option to uninstall a package and remove the configuration files.

[root@server1 ~]# apt-get purge package_name

 

Use the autoremove option to remove a package and the dependencies used by the package.

[root@server1 ~]# apt-get autoremove package_name

 


PACKAGE CONTENTS

Use the apt-file list command to view all of the files installed by the package.

[root@server1 ~]# apt-file list package_name

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter in the box below so that we can be sure you are a human.




Comments