yum Archives - Justin Silver https://www.justinsilver.com/tag/yum/ Technology, Travel, and Pictures Wed, 10 May 2017 21:58:18 +0000 en-US hourly 1 https://wordpress.org/?v=6.0.1 https://www.justinsilver.com/wp-content/uploads/2013/06/cropped-apple-touch-icon-160x160.png yum Archives - Justin Silver https://www.justinsilver.com/tag/yum/ 32 32 Install Jenkins as a Service on CentOS 7 https://www.justinsilver.com/technology/linux/install-jenkins-service-centos-yum/?utm_source=rss&utm_medium=rss&utm_campaign=install-jenkins-service-centos-yum https://www.justinsilver.com/technology/linux/install-jenkins-service-centos-yum/#respond Wed, 27 Apr 2016 19:17:41 +0000 https://www.justinsilver.com/?p=4140 I have previously written about how to Install Jenkins on CentOS as a Service where it was necessary to write your own startup, shutdown, configuration, and init.d scripts. Luckily this is all much easier...

The post Install Jenkins as a Service on CentOS 7 appeared first on Justin Silver.

]]>
AmpedSense.OptimizeAdSpot('AP'); AmpedSense.OptimizeAdSpot('IL'); AmpedSense.OptimizeAdSpot('IR');

I have previously written about how to Install Jenkins on CentOS as a Service where it was necessary to write your own startup, shutdown, configuration, and init.d scripts. Luckily this is all much easier now as you can install the software directly from a yum repository – you’ll just need to fetch the repo from http://pkg.jenkins-ci.org/redhat/jenkins.repo.

Install Jenkins from the Yum Repository

Make sure you have Java on your system, then fetch the yum repository and install Jenkins.

yum -y install java 
curl http://pkg.jenkins-ci.org/redhat/jenkins.repo -o /etc/yum.repos.d/jenkins.repo
rpm --import https://jenkins-ci.org/redhat/jenkins-ci.org.key
yum -y install jenkins

Enable and Start Service

Since CentOS 7 uses Systemd, use it to start the service on reboot.

systemctl enable jenkins
service jenkins start

Access Jenkins

This will start jenkins on port 8080 by default (you can change these settings in /etc/sysconfig/jenkins). Leaving it as is and setting up a reverse Nginx proxy is my preference. Once you load the Jenkins home page you will be prompted to enter a password located in a file on your system to continue the setup. Here is a sample of my Nginx configuration.

# jenkins is upstream listening on port 8080
upstream jenkins {
        server                          127.0.0.1:8080 fail_timeout=0;
}

# nginx is listening on port 80
server {
        listen                          80;
        server_name                     jenkins.example.com;
        
        location / {
        
                proxy_set_header        Host $host:$server_port;
                proxy_set_header        X-Real-IP $remote_addr;
                proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header        X-Forwarded-Proto $scheme;

                proxy_pass              http://jenkins;
        }
}

Keep in mind that you may have issues initially proxying to Jenkins if SELinux is configured to block access to port 8080. If you try to load the site via Ngnix and get a “502 Bad Gateway” error, check out the /var/log/audit/audit.log – you will probably see errors regarding Nginx connecting to your port. You can either add the port by hand, or do it automatically with audit2allow.

mkdir ~/.semanage && cd ~/.semanage
cat /var/log/audit/audit.log | grep nginx | grep denied | audit2allow -M semanage
semodule -i semanage.pp

If you need to generate an SSH key for the Jenkins user, use sudo to run as the proper user.

sudo -u jenkins ssh-keygen

Enjoy!

The post Install Jenkins as a Service on CentOS 7 appeared first on Justin Silver.

]]>
https://www.justinsilver.com/technology/linux/install-jenkins-service-centos-yum/feed/ 0
Upgrade wget on CentOS 5 https://www.justinsilver.com/technology/linux/upgrade-wget-centos-5/?utm_source=rss&utm_medium=rss&utm_campaign=upgrade-wget-centos-5 https://www.justinsilver.com/technology/linux/upgrade-wget-centos-5/#comments Sat, 18 Oct 2014 09:54:54 +0000 http://justinsilver.com/?p=3781 As time progresses some of my VPS machines are starting to show their age running CentOS 5. As CentOS is based on Redhat, the yum repositories often contain older versions of binaries with bugs...

The post Upgrade wget on CentOS 5 appeared first on Justin Silver.

]]>
AmpedSense.OptimizeAdSpot('AP'); AmpedSense.OptimizeAdSpot('IL'); AmpedSense.OptimizeAdSpot('IR');

As time progresses some of my VPS machines are starting to show their age running CentOS 5. As CentOS is based on Redhat, the yum repositories often contain older versions of binaries with bugs that have been fixed in newer version. I recently ran into this with wget when trying to download the latest WordPress zip file.

--2014-10-18 01:55:38-- http://wordpress.org/latest.zip
Resolving wordpress.org... 66.155.40.249, 66.155.40.250
Connecting to wordpress.org|66.155.40.250|:80... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://wordpress.org/latest.zip [following]
--2014-10-18 01:55:38-- https://wordpress.org/latest.zip
Connecting to wordpress.org|66.155.40.250|:443... connected.
ERROR: certificate common name *.wordpress.org' doesn't match requested host name wordpress.org'.
To connect to wordpress.org insecurely, use `--no-check-certificate'.
Unable to establish SSL connection.
unzip: cannot find or open latest.zip, latest.zip.zip or latest.zip.ZIP

Turns out this is a bug in wget 1.11 that was fixed in 1.12, but the former is what is available via yum. There is a bug on the WordPress Trac #611 that is closed as wontfix – it has to do with the older version of wget not using the alternate name on the wildcard SSL certificate. If you want to upgrade wget on your system, you’ll need to first get the source, uninstall the existing wget with yum, and then build wget from source. You’ll probably want to jump to 1.16 since all previous versions are susceptible to CVE-2014-4877 as of this post.

Install wget from source

cd ~
wget http://ftp.gnu.org/gnu/wget/wget-1.16.tar.gz
yum -y remove wget
tar -xzvf wget-1.16.tar.gz
cd wget-1.16
./configure --with-ssl=openssl --with-libssl-prefix=/usr/lib64/openssl --prefix=/usr
make && make install

Note: If you don’t have wget on your system at all, you can also use curl to download the source with the command curl -O http://ftp.gnu.org/gnu/wget/wget-1.16.tar.gz.

The post Upgrade wget on CentOS 5 appeared first on Justin Silver.

]]>
https://www.justinsilver.com/technology/linux/upgrade-wget-centos-5/feed/ 4
Install logtail on CentOS https://www.justinsilver.com/technology/linux/install-logtail-centos/?utm_source=rss&utm_medium=rss&utm_campaign=install-logtail-centos https://www.justinsilver.com/technology/linux/install-logtail-centos/#respond Mon, 02 Jun 2014 22:09:36 +0000 http://justin.ag/?p=3599 The developer of logtail has not made the repository available via yum for quick installation. Even if you don’t want to access logtail from the command line, it is still used by several other scripts...

The post Install logtail on CentOS appeared first on Justin Silver.

]]>
AmpedSense.OptimizeAdSpot('AP'); AmpedSense.OptimizeAdSpot('IL'); AmpedSense.OptimizeAdSpot('IR');

The developer of logtail has not made the repository available via yum for quick installation. Even if you don’t want to access logtail from the command line, it is still used by several other scripts and plugins, such as the Nginx plugins for Munin. The easiest way to do this is to install logcheck, which includes logtail. You can use rpm to handle the install, but you will need to install some dependencies first.

Install Dependencies

Use rpm to install the logtail dependencies in the order below – liblockfile, lockfile-progs, perl-mime-construct, and perl-Proc-WaitState. If you already have one of these packages rpm should let you know when you try to re-install it.

liblockfile

rpm -ivh ftp://ftp.univie.ac.at/systems/linux/fedora/epel/5/i386/liblockfile-1.08-9.el5.i386.rpm
Retrieving ftp://ftp.univie.ac.at/systems/linux/fedora/epel/5/i386/liblockfile-1.08-9.el5.i386.rpm
Preparing...                ########################################### [100%]
   1:liblockfile            ########################################### [100%]

liblockfile was successfully installed.

lockfile-progs

rpm -ivh ftp://ftp.univie.ac.at/systems/linux/fedora/epel/5/i386/lockfile-progs-0.1.15-2.el5.i386.rpm
Retrieving ftp://ftp.univie.ac.at/systems/linux/fedora/epel/5/i386/lockfile-progs-0.1.15-2.el5.i386.rpm
Preparing...                ########################################### [100%]
   1:lockfile-progs         ########################################### [100%]

lockfile-progs was successfully installed.

perl-mime-construct

rpm -ivh ftp://ftp.univie.ac.at/systems/linux/fedora/epel/5/i386/perl-mime-construct-1.11-2.el5.noarch.rpm
Retrieving ftp://ftp.univie.ac.at/systems/linux/fedora/epel/5/i386/perl-mime-construct-1.11-2.el5.noarch.rpm
Preparing...                ########################################### [100%]
	package perl-mime-construct-1.11-2.el5.noarch is already installed

perl-mime-construct was already installed.

perl-Proc-WaitStat

rpm -ivh ftp://ftp.univie.ac.at/systems/linux/fedora/epel/5/i386/perl-Proc-WaitStat-1.00-2.el5.noarch.rpm
Retrieving ftp://ftp.univie.ac.at/systems/linux/fedora/epel/5/i386/perl-Proc-WaitStat-1.00-2.el5.noarch.rpm
Preparing...                ########################################### [100%]
	package perl-Proc-WaitStat-1.00-2.el5.noarch is already installed

perl-Proc-WaitStat was already installed.

Install logcheck

Now we’re ready to install logcheck. Use the following rpm to wrap up the install.

rpm -ivh ftp://ftp.univie.ac.at/systems/linux/fedora/epel/5/i386/logcheck-1.3.13-6.el5.noarch.rpm
Retrieving ftp://ftp.univie.ac.at/systems/linux/fedora/epel/5/i386/logcheck-1.3.13-6.el5.noarch.rpm
Preparing...                ########################################### [100%]
   1:logcheck               ########################################### [100%]

Run logtail

Now that logcheck is installed, you should be able to call logtail from the command line, or other scripts and plugins.

[root@web1 ~]# logtail
No logfile to read. Use -f [LOGFILE].

The post Install logtail on CentOS appeared first on Justin Silver.

]]>
https://www.justinsilver.com/technology/linux/install-logtail-centos/feed/ 0
Upgrade From MySQL to MariaDB on CentOS https://www.justinsilver.com/technology/upgrade-mysql-mariadb-centos/?utm_source=rss&utm_medium=rss&utm_campaign=upgrade-mysql-mariadb-centos https://www.justinsilver.com/technology/upgrade-mysql-mariadb-centos/#comments Tue, 22 Apr 2014 08:57:12 +0000 http://justin.ag/?p=3484 Here is how you upgrade from MySQL 5.5+ to MariaDB 5.5, 5.6 or 10.0. After running MySQL 5.5 for a while and getting tired of not taking advantage of the features and performance enhancements,...

The post Upgrade From MySQL to MariaDB on CentOS appeared first on Justin Silver.

]]>
AmpedSense.OptimizeAdSpot('AP'); AmpedSense.OptimizeAdSpot('IL'); AmpedSense.OptimizeAdSpot('IR');

Here is how you upgrade from MySQL 5.5+ to MariaDB 5.5, 5.6 or 10.0.

After running MySQL 5.5 for a while and getting tired of not taking advantage of the features and performance enhancements, I took things to the next level and decided to just install MariaDB 10. It’s a drop in replacement for MySQL, which means that MariaDB will be able to use the same client binaries, data files, and configurations but will also support the new features found in the latest version of MySQL, as well as some things only found in the MariaDB fork.

Backup First!

The first things you should do is make a back-up of your existing configuration. MySQL has it’s data in /var/lib/mysql on my server, so I just ran cp -R /var/lib/mysql /var/lib/mysql-bak before getting wild.

Install MariaDB Yum Repository

You will then want to install the yum repository for the version of MariaDB you want to install. There is a pretty handy tool provided by the developers of MariaDB to choose the repository best suited for your system located at https://downloads.mariadb.org/mariadb/repositories/. On my setup – 64 bit CentOS 5.10 – I created a file at /etc/yum.repos.d/MariaDB.repo with the following contents.

# MariaDB 10.0 CentOS repository list - created 2014-04-21 22:57 UTC
# http://mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.0/centos5-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

Remove MySQL

Since I already had a database running on this server, the next task is to remove the existing packages on the server. You can see the list of what’s installed with yum list installed | grep mysql. Just uninstall the MySQL packages with yum.

yum -y remove mysql*

Remove InnoDB Log Files

This isn’t a step that I took when I did this the first time, and it resulted in MariaDB not being able to start the mysqld daemon. Trying service start mysqld did nothing at all and running sudo -u mysql mysqld only got me as far as seeing the following error.

140421 23:10:40 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
140421 23:10:40 [Note] InnoDB: The InnoDB memory heap is disabled
140421 23:10:40 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
140421 23:10:40 [Note] InnoDB: Compressed tables use zlib 1.2.3
140421 23:10:40 [Note] InnoDB: Using Linux native AIO
140421 23:10:40 [Note] InnoDB: Using CPU crc32 instructions
140421 23:10:40 [Note] InnoDB: Initializing buffer pool, size = 128.0M
140421 23:10:40 [Note] InnoDB: Completed initialization of buffer pool
140421 23:10:40 [ERROR] InnoDB: Log file ./ib_logfile2 is of different size 0 bytes than other log files 5242880 bytes!
140421 23:10:40 [ERROR] Plugin 'InnoDB' init function returned error.
140421 23:10:40 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
140421 23:10:40 [Note] Plugin 'FEEDBACK' is disabled.
140421 23:10:40 [ERROR] Unknown/unsupported storage engine: InnoDB
140421 23:10:40 [ERROR] Aborting
140421 23:10:40 [Note] /usr/sbin/mysqld: Shutdown complete

After much searching, I found out that I just needed to remove the ib_logfiles before the call to service mysql start.

rm -rf /var/lib/mysql/ib_logfile*

Run mysql_upgrade

Once MariaDB is up and running, you should now be able to connect to the database server. That said, you may not actually be able to run any queries. Many of mine were returning with the error Error in query (1548): Cannot load from mysql.proc. The table is probably corrupted. Running mysql_upgrade to complete the switch to MariaDB did the trick and all was now working as expected.

mysql_upgrade -u root -p

Start MariaDB

I am used to the init.d script being known as mysqld so I accounted for this by running ln -s /etc/init.d/mysql /etc/init.d/mysqld before starting the daemon.

service mysqld start

The post Upgrade From MySQL to MariaDB on CentOS appeared first on Justin Silver.

]]>
https://www.justinsilver.com/technology/upgrade-mysql-mariadb-centos/feed/ 3
Munin mysql_ suggest Cache::Cache Error https://www.justinsilver.com/technology/linux/munin-mysql_-suggest-cachecache-error/?utm_source=rss&utm_medium=rss&utm_campaign=munin-mysql_-suggest-cachecache-error https://www.justinsilver.com/technology/linux/munin-mysql_-suggest-cachecache-error/#respond Mon, 14 Apr 2014 03:57:41 +0000 http://justin.ag/?p=3434 I was trying to set up the newer mysql_ plugin for Munin, but got the following error when using the “suggest” argument to determine how to link the file. The “fix” was to install...

The post Munin mysql_ suggest Cache::Cache Error appeared first on Justin Silver.

]]>
AmpedSense.OptimizeAdSpot('AP'); AmpedSense.OptimizeAdSpot('IL'); AmpedSense.OptimizeAdSpot('IR');

I was trying to set up the newer mysql_ plugin for Munin, but got the following error when using the “suggest” argument to determine how to link the file. The “fix” was to install the perl-Cache-Cache.noarch package via yum.

Missing dependency Cache::Cache at ./mysql_ line 728

As an FYI – you install different graphs from a single plugin by creating a symbolic link to the plugin with an appropriate name, for example:

ln -s mysql_ mysql_connections

The Error

Unable to suggest the plugin options.

[root@db1 plugins]# ./mysql_ suggest
Missing dependency Cache::Cache at ./mysql_ line 728.

The “Fix”

Install Perl’s Cache::Cache.

yum -y install perl-Cache-Cache.noarch

Success

You should now be able to suggest the plugin options.

[root@db1 plugins]# ./mysql_ suggest
bin_relay_log
commands
connections
files_tables
innodb_bpool
innodb_bpool_act
innodb_insert_buf
innodb_io
innodb_io_pend
innodb_log
innodb_rows
innodb_semaphores
innodb_tnx
myisam_indexes
network_traffic
qcache
qcache_mem
replication
select_types
slow
sorts
table_locks
tmp_tables

The post Munin mysql_ suggest Cache::Cache Error appeared first on Justin Silver.

]]>
https://www.justinsilver.com/technology/linux/munin-mysql_-suggest-cachecache-error/feed/ 0
Upgrade Python on CentOS https://www.justinsilver.com/technology/linux/upgrade-python-centos/?utm_source=rss&utm_medium=rss&utm_campaign=upgrade-python-centos https://www.justinsilver.com/technology/linux/upgrade-python-centos/#respond Fri, 21 Mar 2014 22:29:41 +0000 http://justin.ag/?p=3337 The version of python that is distributed with CentOS is the same of that for RHEL, which reads as not cutting edge. Typically this will be version 2.6, so even to run 2.7.6 you...

The post Upgrade Python on CentOS appeared first on Justin Silver.

]]>
AmpedSense.OptimizeAdSpot('AP'); AmpedSense.OptimizeAdSpot('IL'); AmpedSense.OptimizeAdSpot('IR');

The version of python that is distributed with CentOS is the same of that for RHEL, which reads as not cutting edge. Typically this will be version 2.6, so even to run 2.7.6 you will need to build from source, but can still leverage yum to fetch all the dev tools you’ll need to build upgraded version of python. Here is how to upgrade python on CentOS for both 2.7 and 3.3. Tweak the version as you wish since newer versions will become available after this is posted.

Python 2.7.6

Downloads Python-2.7.6.tar.xz and builds it.

#!/usr/bin/sh

mkdir -p ~/python2.7
cd ~/python2.7
yum groupinstall -y development
yum install -y bzip2-devel openssl-devel sqlite-devel wget xz-libs zlib-dev 
wget http://www.python.org/ftp/python/2.7.6/Python-2.7.6.tar.xz
xz -d Python-2.7.6.tar.xz
tar -xvf Python-2.7.6.tar
cd Python-2.7.6
./configure --prefix=/usr/local
make && make install

Python 3.3.3

Same same but different. Python-3.3.3.tar.xz.

#!/usr/bin/sh

mkdir -p ~/python3.3
cd ~/python3.3
yum groupinstall -y development
yum install -y bzip2-devel openssl-devel sqlite-devel wget xz-libs zlib-dev 
wget http://www.python.org/ftp/python/3.3.3/Python-3.3.3.tar.xz
xz -d Python-3.3.3.tar.xz
tar -xvf Python-3.3.3.tar
cd Python-3.3.3 
./configure
make && make install

The post Upgrade Python on CentOS appeared first on Justin Silver.

]]>
https://www.justinsilver.com/technology/linux/upgrade-python-centos/feed/ 0
Install PHP Memcached() on CentOS 5 https://www.justinsilver.com/technology/linux/install-php-memcached-on-centos-5/?utm_source=rss&utm_medium=rss&utm_campaign=install-php-memcached-on-centos-5 https://www.justinsilver.com/technology/linux/install-php-memcached-on-centos-5/#respond Sun, 27 May 2012 02:18:59 +0000 http://justin.ag/?p=2473 If you want to have direct access to the Memacache() object from PHP on CentOS, the easiest way is using yum and the Remi repository. To install the repository for various platforms, see http://blog.famillecollet.com/pages/Config-en...

The post Install PHP Memcached() on CentOS 5 appeared first on Justin Silver.

]]>
AmpedSense.OptimizeAdSpot('AP'); AmpedSense.OptimizeAdSpot('IL'); AmpedSense.OptimizeAdSpot('IR');

If you want to have direct access to the Memacache() object from PHP on CentOS, the easiest way is using yum and the Remi repository.

To install the repository for various platforms, see http://blog.famillecollet.com/pages/Config-en but basically type the following:

wget http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
rpm -Uvh remi-release-5*.rpm epel-release-5*.rpm

The repository is not enabled by default, but you can edit it in /etc/yum.repos.d/remi.repo setting enablerepo to 1 to have it always on. Otherwise use –enablerepo=remi in your yum commands.

yum --enablerepo=remi install memcached php-pecl-memcache php-pecl-memcached

The post Install PHP Memcached() on CentOS 5 appeared first on Justin Silver.

]]>
https://www.justinsilver.com/technology/linux/install-php-memcached-on-centos-5/feed/ 0