'No package nginx available' error CentOS 6.5 - linux

I'm trying to install nginx on CentOS 6.5, then I added these lines on file /etc/yum.repos.d/nginx.repo
Then install nginx by:
And I've got a message error: No package nginx available
How can I fix it? I would greatly appreciate any help you can give me in working this problem!

nginx is not a part of base CentOS repository.
But you can install EPEL repositiry to get nginx:
yum install epel-release
and then
yum install nginx

This should work well for oraclelinux7
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum -y install nginx
Dockerfile to install nginx on oraclelinux:
FROM oraclelinux:7-slim
RUN rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
RUN yum -y install nginx && yum clean all && rm -rf /var/cache/yum
EXPOSE 80
ENTRYPOINT ["nginx", "-g", "daemon off;"]

Your repo url is having an error.
It is necessary to manually replace $releasever with either "5" (for 5.x) or "6" (for 6.x), depending upon your OS version. Similarly you have to edit the $basearch also.
After that do the following command
yum clean all
yum install nginx
An alternative option is to install the epel repository and install nginx from there.
yum install epel-release
yum clean all
yum install nginx

What worked for me (CentOS 7.1) was removing epel first:
yum remove epel-release
yum install epel-release
yum update
yum install nginx

Install nginx first! Run the following commands to first add the EPEL repository (Extra Packages for Enterprise Linux) and then install nginx.
yum install epel-release
yum install nginx

Try to disable plugins for yum:
vim /etc/yum.conf
set plugins=0, and re-install epel-release:
yum remove epel-release
yum install epel-release
yum install nginx
this works for me, good luck!

Check if it is excluded from the yum source:
Use vi /etc/yum.conf
Check the exclude option

Although the otherwise-posted advice regarding manually setting the $releasever and $basearch values in the repo file will not hurt per se (at least while you stick to the software release referred to by the values you set), it is not strictly necessary.
I also have the exact contents you have posted, in a file named /etc/yum.repos.d/nginx.repo which functions correctly without having set the above values explicitly.
My advice would be to perform a yum updateprior to attempting to install (as it's possible that when you tried to install, yum had not queried all of the repo URLs from the files in /etc/yum.repos.d/ for the latest versions of their databases). Also make absolutely sure that your created file ends in .repo as otherwise it will be ignored by yum.
Failing that, check the SElinux security contexts on the files in that directory - or just go ahead and manually restore them by running restorecon -Rv '/etc/yum.repos.d' and check the file permissions on the manually created repo file(s), which should be owned by root:root and have show 644 as file permissions. To manually amend these, run chmod 644 /etc/yum.repos.d/nginx.repoand chown root:root /etc/yum.repos.d/nginx.repo
I hope that some part of the above resolves your issues!

Check yum.conf file and it's exclude key
In addition to all above answers, Make sure nginx, httpd or any other package you want to install is not in the exclude list of yum.conf file.
Open yum.conf file located at /etc/yum.conf
Check the exclude key and remove nginx* if it's there
Then try to install your package. in this case nginx:
sudo yum install nginx

Related

How to Install Postgresql 11 in Amazon Linux AMI?

How do I install Postgresql 11 on Amazon Linux 2018.03 (specifically, not AMZ Linux 2) on Elastic Beanstalk?
I want to install a package and not manually build a binary. If an autoscale machine boots and has to build the entire PG binary, it'll take significantly longer on a t2/t3.micro.
I'm looking for pg_dump.
[Edit] Making more verbose, explain why building does not work for my situation.
The key was the PGDG is no longer available to Amazon Linux's yum since 9.3 so the individual pieces must be installed.
# Remove old Postgres
yum remove -y postgresql postgresql-server
# Install Postgres 11
yum install -y https://download.postgresql.org/pub/repos/yum/11/redhat/rhel-6-x86_64/postgresql11-libs-11.4-1PGDG.rhel6.x86_64.rpm
yum install -y https://download.postgresql.org/pub/repos/yum/11/redhat/rhel-6-x86_64/postgresql11-11.4-1PGDG.rhel6.x86_64.rpm
yum install -y https://download.postgresql.org/pub/repos/yum/11/redhat/rhel-6-x86_64/postgresql11-server-11.4-1PGDG.rhel6.x86_64.rpm
[edit]
Replace the 11.4 in each link above with any version you need available at https://download.postgresql.org/pub/repos/yum/11/redhat/rhel-6-x86_64/
sudo yum update
sudo amazon-linux-extras install postgresql11
Looks like there's no PostgreSQL 11 pre-built binary distribution for Amazon Linux. The way I solve it was to build from source code:
wget https://ftp.postgresql.org/pub/source/v11.5/postgresql-11.5.tar.gz
tar zxvf postgresql-11.5.tar.gz
cd postgresql-11.5
./configure --without-readline
make
make install
By default, it will install pg_dump into /usr/local/pgsql/bin/pg_dump.
This is an extended version of #nitsujri answer. I can't comment their comment, so I will create new answer here.
Install prerequisites:
sudo yum install readline-devel
sudo yum group install "Development Tools"
Download PostgreSQL source code and install the distro:
wget https://ftp.postgresql.org/pub/source/v11.5/postgresql-11.5.tar.gz
tar zxvf postgresql-11.5.tar.gz
cd postgresql-11.5
./configure
make
sudo make install
Add this line to your ~/.bashrc. After that relogin to an EC2 instance.
export PATH=/usr/local/pgsql/bin:$PATH

Unable to install libsasl2-devel on Amazon Linux 2 machine

I am running Ansible playbook and trying to install OS dependencies packages for python. I am trying to run the following:
sudo yum install gcc gcc-c++ libffi-devel python-devel python-pip python-wheel openssl-devel libsasl2-devel openldap-devel
However, it fails at installing libsasl2-devel with the message:
"No package matching 'libsasl2-devel' found available, installed or updated"
All my instances are Amazon Linux 2 machines. Is there any alternative package for this? I tried to look into this but I found solutions for Ubuntu only.
I was able to get it to work in a series of steps. Its a yum issue after other databases are installed and not cleaned up before installing mysql
clear sasl first: sudo yum remove cyrus-sasl
if you have installed maria, there will be conflicts, remove that as well
sudo yum remove mariadb mariadb-server mariadb-libs
take note of anything uninstalled by this to re-add later. If this is too much, you can take a risk and not remove sasl, but it might not reset the availability of the package.
Start here to clean up the dependency issues: https://serverfault.com/questions/873955/how-solve-mysql-5-7-dependency follow the command given by clean all as sudo rm -rf /var/cache/yum/*
This can possibly resolve your issues right there, if not continue the installation below.
delete all data left in /var/lib/mysql/ or you may have upgrade issues.
resinstall sasl:
sudo yum install cyrus-sasl cyrus-sasl-devel and any other packages removed above.
Establish mysql5.7 with the yum services.
wget https://dev.mysql.com/get/mysql57-community-release-el6-11.noarch.rpm
sudo yum localinstall -y mysql57-community-release-el6-11.noarch.rpm
sudo yum repolist enabled | grep "mysql.*-community.*"
sudo yum repolist enabled | grep mysql
sudo yum install -y mysql-community-common mysql-community-libs mysql-community-server mysql-community-client
if that doesn't work, re-clear the yum cache again and re-run sudo yum install -y mysql-community-server
if that works, then
sudo service mysqld start
IF the /var/lib/mysql is empty, it will have created a temporary password in the /var/log/mysqld.log (use sudo to read)
run sudo mysql_secure_installation and establish your real password and security settings.
now you should have access via mysql -u root -p

puppet master fresh installation error

puppet master was working fine in my ubuntu 12.04 server. Today I uninstalled it using the following commands and made a fresh install again. After a fresh install, puppet master failed to start.
sudo apt-get remove puppetmaster-common
sudo apt-get remove --auto-remove puppetmaster-common
sudo apt-get purge puppetmaster-common
sudo apt-get purge --auto-remove puppetmaster-common
sudo apt-get remove puppet
sudo apt-get remove --auto-remove puppet
sudo apt-get purge puppet
sudo apt-get purge --auto-remove puppet
After a fresh install, it's totally stopped working and I am getting the below errors in log
Could not autoload puppet/type/user: Could not autoload
puppet/provider/user/directoryservice: cannot load such file
Could not autoload puppet/provider/user/directoryservice: cannot load
such file -- plist
Could not autoload puppet/type/user: Could not autoload
puppet/provider/user/directoryservice: cannot load such file
Could not create resources for managing Puppet's files and directories
in sections [:main, :master, :ssl, :metrics]
Could not prepare for execution: Could not create resources for
managing Puppet's files and directories in sections
Also, there is no puppet.conf file exists in /etc/puppet/puppet.conf location even after fresh install. I tried installing twice and I couldn't see this file getting generated.
Puppet version 3.8.5.
Ubuntu : 12.04 version
Could someone help me to resolve this issue?
Matt, I figured it out finally.
I just removed the existing apt repository by manually deleting the entries in
/etc/apt/sources.list.d
and removed puppetlabls-pc1.list, puppet.list, puppet.save, all entries related to puppet and then invoked
sudo apt-get update
And installed puppet master once again without appending any additional apt repos
sudo apt-get -y install puppetmaster
I think I was using wrong apt source. It wasn't generating puppet.conf file at all. May be thats the reason why I was getting weired errors like that

xz compression install on centos

Any installation or update using yum command I ended up error: Error: xz compression not available. On website I read that Python library is missing. When you try to install a library (sudo yum update pyliblzma) again failed with error. Do not know how? Thanks.
This problem comes if you installed a wrong epel release on your machine. If so, then you need to remove the epel release by
yum remove epel-release
Sometimes that is not enough, you need to remove the cache as well by:
rm -rf /var/cache/yum/x86_64/6/epel
Then you can install the epel-release again
yum -y install epel-release
You need install the EPEL repository by downloading the appropriate RPM package for your system and installing it. For example, for CentOS and Red Hat Enterprise Linux 6.x:
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
sudo rpm -Uvh epel-release-6*.rpm
If you get a File Not Found error message when trying to download the package, the version number might have changed. You can access the latest version of the RPM installer from the Fedora EPEL wiki page. The wiki page also includes additional instructions for Red Hat Network subscribers who are installing the EPEL repository.
Finally, install the Python library:
yum install pyliblzma
This works perfecly in my CentOS 6.x.
I've found a solution on this page of stackexchange, working in CentOS 6.X:
https://unix.stackexchange.com/a/314756
sudo rpm -e epel-release-7-5.noarch
wget http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
sudo rpm -ivh epel-release-6-8.noarch.rpm
sudo yum clean all
sudo rpmdb -v --rebuilddb
sudo yum -y install libselinux-python
I was also suffering from this issue..
If you are installing packages but it is already available on your system.
Remove existing packages and then try to install new.
It will work properly...
I was able to solve this problem by installing pyliblzma using rpm instead of yum as yum is not working.
Find pyliblzma rpm package according to your architecture and install it using the command.
rpm -Uvh pyliblzma-version-release.architecture.rpm
I used the following command to install pyliblzma for my 64 bit Redhat 6.8 machine. Please check URL in the command and make changes accordingly.
rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/pyliblzma-0.5.3-3.el6.x86_64.rpm
In my case the issue was caused by missing modules in python's site-packages directory. Here's what I did:
$ rpm -Va
to get a list of all files belonging to all rpms that do not verify. I got a bunch of messages about missing modules:
missing /usr/lib64/python2.7/site-packages/...
Luckily, I had an identical CentOS version elsewhere with all these packages present, so I just copied them over and ran
$ rpmdb -v --rebuilddb
to rebuild rpm database.

Installing phpMyAdmin on Amazon Linux

After installing phpMyAdmin on Amazon Linux using these commands...:
sudo yum --enablerepo=epel install phpmyadmin
sudo ln -s /usr/share/phpmyadmin /var/www/html/phpmyadmin
... I have tried the steps described in this tutorial (referred to in previous StackOverflow Answers), but do get the following error message after issuing the command
sudo chmod 0700 /etc/httpd/conf.d/phpmyadmin.conf: File or Directory not found.
How can I get phpMyAdmin running on Amazon Linux?
You can install phpmyadmin rpm package by yum command to enabling epel repositories
yum --enablerepo=epel install phpmyadmin
You'll then have to change the phpMyAdmin config file to allow access from your IP.
Oh and you probably need to change your sudo command to be case sensitive. Double check your filename, but on my system it would be
sudo chmod 0700 /etc/httpd/conf.d/phpMyAdmin.conf
When I first tried to install phpMyAdmin on Amazon Linux, I got some trouble; even though, I had already using epel-release options.
What I did was:
sudo yum install epel-release
sudo yum install phpmyadmin
I got error
No package phpmyadmin available.
If you got the same error you could try
sudo rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
then
sudo yum --enablerepo=remi install phpmyadmin
should works.
As previous post said, you might need update the conf of phpmyadmin on Apache for public access. After
sudo chmod 0700 /etc/httpd/conf.d/phpMyAdmin.conf
You should update the config
<IfModule !mod_authz_core.c>
# Apache 2.2
Order Deny,Allow
Allow from All
#Deny from All
#Allow from 127.0.0.1
#Allow from ::1
</IfModule>
then you should be able to access phpMyAdmin by http://domainname.com/phpMyAdmin now.
Reference:
How To Install and Secure phpMyAdmin on a CentOS 6.4 VPS
Allowing network access to PHPMyAdmin
Install phpMyAdmin 4.3.10 on Fedora 21/20, CentOS/RHEL 6.6/5.11
There's a great tutorial in the Amazon EC2 documentation that covers installing a LAMP web server stack on Amazon Linux. One of the optional procedures in that topic includes installing phpMyAdmin.

Resources