yum-config-manager --add-repo https://my-server/yum-proxy/ generates strange name - yum

I have created a yum proxy in nexus using this guide:
https://help.sonatype.com/repomanager3/formats/yum-repositories#YumRepositories-ProxyingYumRepositories
No I would like to add the proxy to yum. I do:
yum-config-manager --add-repo https://my-server/yum-proxy/
which outputs:
[my-server_yum-proxy_]
name=added from: https://my-server/yum-proxy/
baseurl=https://my-server/yum-proxy/
enabled=1
but that name looks rather strange. Is it not possible to specify the name to the command when adding the repo?

unfortunately it seems like yum-config-manager does not have an option to specify the name. If the name bothers you, you can generate the repository manually like this:
echo "[my-proxy]
name=my-proxy
baseurl=https://my-server/yum-proxy/
enabled=1" | sudo tee /etc/yum.repos.d/my-proxy.repo

Related

How to enable and disable yum repos using the command line

I'm attempting to edit the yum.repos.d file in order to disable unwanted repos and enable wanted repos without using the vi editor. Each time I use the method I know of it fails to make the changes. Does anyone know what I'm missing?
See Below:
yum-config-manager --disable \therepoid,anotherrepoid
Note: I'm not executing this from the yum.repos.d directory
First you need to run the command as root
Then you should get the list of repos:
yum repolist all
And then you can enable or disable particular repo(s) by repo_id from previous command
yum-config-manager --enable repo_id
For reference you can use RedHat documentation

When using Centos 6, I cannot run 'yum update' anymore, I get this error 'Cannot find a valid baseurl for repo: base'

When using VirtualBox with a Centos6 image I cannot do yum udpate anymore, I have checked on the internet and it looks that Centos6 is deprecated.
[root#centos69 ~]# yum makecache
Failed to set locale, defaulting to C
Loaded plugins: fastestmirror, refresh-packagekit, security
Determining fastest mirrors
YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
Eg. Invalid release/repo/arch combination/
removing mirrorlist with no valid mirrors: /var/cache/yum/x86_64/6/base/mirrorlist.txt
Error: Cannot find a valid baseurl for repo: base
[root#centos69 ~]# yum update
Failed to set locale, defaulting to C
Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Update Process
Loading mirror speeds from cached hostfile
YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
Eg. Invalid release/repo/arch combination/
removing mirrorlist with no valid mirrors: /var/cache/yum/x86_64/6/base/mirrorlist.txt
Error: Cannot find a valid baseurl for repo: base
There could be two possible solutions to solve this issue:
Edit the CentOS-Base.repo file with vim
vim /etc/yum.repos.d/CentOS-Base.repo
Delete or comment every line that starts with 'mirrorlist'.
And add the following line to every [section] of the file like [base], [updates]...
baseurl=https://vault.centos.org/6.10/os/$basearch/
Another solution could be running this command on an image that comes from this repo https://vault.centos.org/
/scripts/autorepair centos6_base_repo_is_no_more
More information about these solutions:
 
https://support.cpanel.net/hc/en-us/articles/360058490254--CentOS-6-End-of-Life-Notice
 
https://forums.cpanel.net/threads/yumrepo-error-and-cannot-find-valid-baseurl.682465/
Yes, like red hat 6.x centos 6 did go EOL in november 2020, hope you don't have anything sensitive stuff in that vm.
https://forums.centos.org/viewtopic.php?t=72710
You can change to use the vault at vault.centos.org. First you should disable any repo that no longer work. You can get a list of repos with
yum repolist
then you can disable them with
yum-config-manager --disable {reponame} {reponame}
like
yum-config-manager --disable base update
or just disable all of them
yum-config-manager |grep ^\\[|tr -d ']['|xargs yum-config-manager --disable
Once the broken repos are disabled you need to add the vault repo.
yum-config-manager --add-repo=https://vault.centos.org/6.10/os/x86_64/
After that you can install packages as needed but remember - it's no updates to anything so if security is a concern you need to change os to something newer that is supported.
followed this post and it worked.
https://www.getpagespeed.com/server-setup/how-to-fix-yum-after-centos-6-went-eol
The alternative method in the post:
vi /etc/yum.repos.d/CentOS-Base.repo
and replace the content with this:
[C6.10-base]
name=CentOS-6.10 - Base
baseurl=http://vault.epel.cloud/6.10/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
enabled=1
metadata_expire=never
[C6.10-updates]
name=CentOS-6.10 - Updates
baseurl=http://vault.epel.cloud/6.10/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
enabled=1
metadata_expire=never
[C6.10-extras]
name=CentOS-6.10 - Extras
baseurl=http://vault.epel.cloud/6.10/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
enabled=1
metadata_expire=never
[C6.10-contrib]
name=CentOS-6.10 - Contrib
baseurl=http://vault.epel.cloud/6.10/contrib/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
enabled=0
metadata_expire=never
[C6.10-centosplus]
name=CentOS-6.10 - CentOSPlus
baseurl=http://vault.epel.cloud/6.10/centosplus/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
enabled=0
metadata_expire=never

What is the equivalent of apt-key in yum?

I am following a tutorial that can be found here to set up a headless selenium scraper on an ec2 instance:
https://krbnite.github.io/Driving-Headless-Chrome-with-Selenium-on-AWS-EC2/
The tutorial I am using seems to assume an ubuntu distro whereas the ec2 instance I am using is an AWS AMI. As such apt-get is not available to me and instead I use yum to install things.
The first step of the installation process is the following:
wget -q -O - "https://dl-ssl.google.com/linux/linux_signing_key.pub" | sudo apt-key add -
When I do this I get the following, to be expected error on my AWS AMI instance:
sudo: apt-key: command not found
I was wondering what the equivalent command would be without using apt, apt-get, or apt-key but instead using yum. I have blindly tried the following but they did not work:
wget -q -O - "https://dl-ssl.google.com/linux/linux_signing_key.pub" | sudo yum add -
wget -q -O - "https://dl-ssl.google.com/linux/linux_signing_key.pub" | sudo yum-key add -
Thanks
Below is from an article on Baeldung which I think answers this questions properly:
Adding a repository in YUM is a manual operation, which consists in creating a file with the .repo extension under the folder /etc/yum.repos.d.
The file must contain all the information about the custom repository that we are connecting to.
Let’s try adding the AdoptOpenJDK repository:
# /etc/yum.repos.d/adoptopenjdk.repo
[AdoptOpenJDK]
name=AdoptOpenJDK
baseurl=http://adoptopenjdk.jfrog.io/adoptopenjdk/rpm/centos/7/$(uname -m)
enabled=1
gpgcheck=1
gpgkey=https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public
In APT, though, things are quite different. The GPG key of the repository must be downloaded and added to the APT keyring with apt-key add:
wget -qO - https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public | sudo apt-key add -
Then, at this point, the repository can be added through add-apt-repository –yes followed by the URL:
add-apt-repository --yes https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/
Contrary to YUM, all the repositories are saved in a single file,
/etc/apt/sources.list.
Add the repo and then import the repo GPG key
sudo wget -o /etc/yum.repos.d/reponame.repo <repo url>
sudo rpm --import <key url>
Confirm
yum repolist

How to install OpenLDAP password check module in ubuntu?

We recently installed ppolicy module and the related things in our OpenLDAP instance for password policy ( http://www.zytrax.com/books/ldap/ch6/ppolicy.html#account-unlock) . However, among them there was no way to set up something that does a password check whenever a new password is set. Then, we were pointed out to this link - http://ltb-project.org/wiki/documentation/openldap-ppolicy-check-password , where pwdPolicyChecker seemed like a module that can solve this issue. But we have no idea how to install this C module in our current ubuntu OpenLDAP set up. Also, the instructions provided seemed to be more like how the openldap setup used to be earlier in ubuntu and not like how it is now with slapd.d . Has anyone done an installation of a C module in OpenLDAP in the new ubuntu setup? Any pointers toward that would be very much appreciated.
Thanks!
I've been using the LTB's pwdCheckerModule for years without a glitch.
I just rebuilt it - as a package, for Debian/Stretch - using the tweaked Onyx Point's version; https://github.com/onyxpoint/ppolicy-check-password
I created the corresponding Debian-specific fork - https://github.com/cedric-dufour/ppolicy-check-password/tree/debian-stretch - including the README.DEBIAN file that should answer your question (most relevant part copied below); doing the same for Ubuntu should not be too different.
* Get the Debian source code for the OpenLDAP packages and build dependencies:
apt-get source openldap
apt-get build-deps openldap
* Include the ppolicy-check-password source code into the OpenLDAP source tree
and install additional build dependencies:
cd openldap-<version>
mkdir -p contrib/slapd-modules/ppolicy-check-password
cp /path/to/ppolicy-check-password.git/* contrib/slapd-modules/ppolicy-check-password/.
apt-get install libcrack2-dev
* Patch the Debian (packaging) directory:
patch -p1 < /path/to/ppolicy-check-password.git/debian/debian-directory.patch
* Build the OpenLDAP packages:
dpkg-buildpackage -us -uc -b
* Copy and install the slapd-ppolicy-check-password_<version>.deb package to
the target server:
dpkg -i slapd-ppolicy-check-password_<version>.deb
* Configure the ppolicy-check-password module:
vim /etc/ldap/check_password.conf
* Add the ppolicy-check-password module/check to your PPolicy:
pwdCheckModule: check_password.so
pwdCheckQuality: 2

Is it possible to use AWS Beanstalk's .ebextensions config to install mod_pagespeed Apache module?

I'm using AWS Beanstalk for my Django/Python application, and I would like to use Google's mod_pagespeed module. Is it possible to install and run mod_pagespeed using the .ebextensions/.config file?
Download the package
Add the rpm into your ebextensions directory
create a .config file in the .ebextensions directory
add commands to the config file like this:
container_commands:
01-command:
command: rm -rf /pagespeed/ebextensions
02-command:
command: mkdir -p /pagespeed/ebextensions
03-command:
command: cp -R .ebextensions/* /pagespeed/ebextensions/
04-command:
command: rpm -U /pagespeed/ebextensions/mod-pagespeed.rpm
Ensure the commands are indented as shown, with no tabs, otherwise it wont work.
swap "mod-pagespeed.rpm" for whatever the actual rpm file name is.
Ok so I want to add Charlie Smith's answer. I would suggest you make sure you have the following things turned on.
mod_deflate - You probably want to Gzip your html, css, xml, and javascript.
Enable the rewrite domains filter in your Apache.conf if you use CDN (ex. AWS CloudFront)
Set a short cache-control for images and css so pagespeed will be able to extend the cache when you turn on the extend_cache filter.
I also like the rewrite_javascript, dns_prefetch, collapse_whitespace, and combine_javascript filters.
Here are the GitHub Gists that show you how its done.
The apache conf file
The Beanstalk container_commands (they are mostly the same as Charlie's)
Thanks guys! I got it working great following your answer #man2xxl.
You don't have to mess with the /pagespeed/extensions directory though, the beanstalk .ebextensions config can simply be:
packages:
yum:
at: []
10_setup_apache_for_mod_pagespeed:
command: "cp enable_mod_pagespeed.conf /etc/httpd/conf.d"
20_install_mod_pagespeed:
command: rpm -U -iv --replacepkgs mod-pagespeed-*.rpm
30_clear_mod_pagespeed_cache:
command: touch /var/cache/mod_pagespeed/cache.flush
You can install packages by URL. So you don't have to download and distribute the RPM. Something like this works:
packages:
rpm:
pagespeed: https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-stable_current_x86_64.rpm
files:
"/etc/httpd/conf.d/zzzz-pagespeed-options.conf":
mode: "00644"
owner: root
group: root
encoding: plain
content: |
# put your pagespeed configuration here
Note that I titled the file zzzz-pagespeed-options.conf so that the httpd server will load it last.
Another advantage of this is you really don't need include any commands whatsoever or worry about copying files over
and maintaining the files in your .ebextensions folder. You just update the files entry in the .config file.