In this tutorial, How to add Repositories on Linux. How to add some useful external repositories for RHEL/Centos or Ubuntu/Debian.
Table of Contents
The procedure to enable repository as follows
- Open a shell prompt
- Install repositories
- Refresh repository
Add Repositories on Linux
Add Repositories for Centos
1. Install a plugin to add priorities
[vagrant@DevopsRoles ~]# yum -y install yum-plugin-priorities
[vagrant@DevopsRoles ~]# sed -i -e "s/\]$/\]\npriority=1/g" /etc/yum.repos.d/CentOS-Base.repo
2. Add Repositories
EPEL Repository
[vagrant@DevopsRoles ~]# yum -y install epel-release
[vagrant@DevopsRoles ~]# sed -i -e "s/\]$/\]\npriority=5/g" /etc/yum.repos.d/epel.repo
Another add Remi’s RPM Repository
[vagrant@DevopsRoles ~]# yum -y install http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
# set [priority=10]
[vagrant@DevopsRoles ~]# sed -i -e "s/\]$/\]\npriority=10/g" /etc/yum.repos.d/remi-safe.repo
Note: if [enabled=0], To use the repository use command below
[vagrant@DevopsRoles ~]# yum --enablerepo=epel install [Package]
Refresh Repositories
[vagrant@DevopsRoles ~]# yum repolist
Add Repositories for Ubuntu & Debian
Using add-apt-repository command
The syntax
add-apt-repository ppa:<ppa_name>
Example,
[vagrant@DevopsRoles ~]$ sudo add-apt-repository ppa:libreoffice/ppa
Fix add-apt-repository: command not found error
[vagrant@DevopsRoles ~]$ sudo apt-get install software-properties-common
[vagrant@DevopsRoles ~]$ sudo apt-get update
Conclusion
Thought the article, How to Add Repositories on Linux as above. I hope will this your helpful. Thank you for reading the DevopsRoles page!
1 thought on “Add Repositories on Linux”