Posts tagged with yum

Avatar-eric-london
Created by Eric.London on 2011-10-28
Tags:
New Comment
 
Please note: the content on this page orginates from ericlondon.com.
Here's a quick linux command to show all the packages you have installed (on RPM based systems, like RHEL and Centos) and what repository they came from. NOTE: the "sort" command sorts the packages by name, and the "column" command outputs the list in a neatly formatted tab delimited display in your terminal.


$ rpm -qa --qf '%{NAME} %{VENDOR}\n' | sort | column -t


Sample output:

$ rpm -qa --qf '%{NAME} %{VENDOR}\n' | sort | column -t | head
acl                                  CentOS
acpid                                CentOS
alsa-lib                             CentOS
amtu                                 CentOS
anacron                              CentOS
ant                                  JPackage  Project
antlr                                JPackage  Project
apr                                  CentOS
apr                                  CentOS
apr-util                             CentOS


And if you wanted to see all packages that came from external (non-Centos) repositories:

$ rpm -qa --qf '%{NAME} %{VENDOR}\n' | sort | column -t | grep -iv Centos
Avatar-eric-london
Created by Eric.London on 2011-06-10
Tags:
New Comment
 
Please note: the content on this page orginates from ericlondon.com.
When Centos came out with php53* packages, I promptly upgraded to test them out. I did not get around to installing PECL and memcache until recently, and soon realized they were no longer available. This article shows how I was able to install PECL and memcache on a Centos (5.6) system using the IUS repository.

Since I am running the php53* packages, the provided php-pecl-memcache package is not compatible. Checking what PECL packages are available:

$ yum list | grep -i ^php.*pecl
php-pecl-Fileinfo.x86_64                 1.0.4-3.el5.centos     extras          
php-pecl-fileinfo.x86_64                 1.0.4-2.el5.rf         rpmforge        
php-pecl-http.x86_64                     1.6.5-2.el5.rf         rpmforge        
php-pecl-mailparse.x86_64                2.1.5-2.el5.rf         rpmforge        
php-pecl-memcache.x86_64                 2.2.5-2.el5.rf         rpmforge        
php-pecl-session_mysql.x86_64            1.9-2.el5.rf           rpmforge        
php-pecl-ssh2.x86_64                     0.11.0-1.el5.rf        rpmforge        
php-pecl-zip.x86_64                      1.8.10-2.el5.rf        rpmforge        


I decided to try out the IUS repository which provides a new set of php53 packages, along with pecl and memcache.


# downloading packages
$ wget http://dl.iuscommunity.org/pub/ius/stable/Redhat/5.5/x86_64/ius-release-1.0-6.ius.el5.noarch.rpm
$ wget http://dl.iuscommunity.org/pub/ius/stable/Redhat/5.5/x86_64/epel-release-1-1.ius.el5.noarch.rpm

# installing packages
$ rpm -Uvh ius-release-1.0-6.ius.el5.noarch.rpm
$ rpm -Uvh epel-release-1-1.ius.el5.noarch.rpm


The IUS packages are also not compatible with the installed php53* packages, so I removed them and installed the new php53u* packages.


# checking which are currently installed
$ yum list | grep -i ^php.*installed
php53.x86_64                            5.3.3-1.el5_6.1         installed       
php53-cli.x86_64                        5.3.3-1.el5_6.1         installed       
php53-common.x86_64                     5.3.3-1.el5_6.1         installed       
php53-devel.x86_64                      5.3.3-1.el5_6.1         installed       
php53-gd.x86_64                         5.3.3-1.el5_6.1         installed       
php53-mbstring.x86_64                   5.3.3-1.el5_6.1         installed       
php53-mysql.x86_64                      5.3.3-1.el5_6.1         installed       
php53-pdo.x86_64                        5.3.3-1.el5_6.1         installed 

# removing existing:
$ yum remove php53*

# installing IUS packages:
$ yum install php53u php53u-cli php53u-common php53u-devel php53u-gd php53u-mbstring php53u-mysql php53u-pdo php53u-pear php53u-pecl-apc php53u-xml php53u-xmlrpc php53u-pecl-memcache


Next, I installed the memcached service.


# install
$ yum install memcached

# set run levels
$ chkconfig --level 2345 memcached on

# start service
$ /etc/init.d/memcached start


After installation, I restarted Apache and checked to ensure memcache was not working.


$ php -i | grep -i memcache\ support
memcache support => enabled


I created a tiny script to test for memcache support:

<?php
$memcache = new Memcache;
$memcache->connect('127.0.0.1', 11211);
print_r($memcache);
?>



$ php memcachetest.php
Memcache Object
(
    [connection] => Resource id #4
)


Now, my system is ready to begin work with the Memcache API and Integration Drupal module :)
Avatar-eric-london
Created by Eric.London on 2011-04-30
Tags:
New Comment
 
Please note: the content on this page orginates from ericlondon.com.
In this article, I'll show the commands I have been using to set up a fresh Centos server, configured for Apache, MySQL, PHP, Tomcat, Drupal, and Apache Solr. For my article, I used Parallels to create a virtual machine from the Centos 5.6 64bit ISOs I downloaded. To simply this article, all commands are being executed as root, firewall configurations and performance tweaks are not accounted for.

Once the distribution is installed, the first thing I do is upgrade all packages.

$ yum update


Install PHP, Apache, and MySQL

$ yum install php53 php53-gd php53-mbstring php53-mysql php53-xml mysql-server httpd


Set runlevels for Apache and MySQL

$ chkconfig --level 2345 httpd on
$ chkconfig --level 2345 mysqld on


Install subversion. I chose to use subversion for this article because the Drupal 6.x installation works well with svn:externals to fetch the SolrPhpClient library. All subversion commands are connecting to a local subversion repository. If you are using an external server (like Beanstalk), you will have to transpose all commands from using "file://" to "https://".

$ yum install subversion


Add a new local subversion repository (OPTIONAL).

$ mkdir /var/subversion
$ svnadmin create /var/subversion/example.com
$ svn mkdir file:///var/subversion/example.com/trunk -m "added trunk"
$ svn mkdir file:///var/subversion/example.com/branches -m "added branches"
$ svn mkdir file:///var/subversion/example.com/tags -m "added tags"


Download/setup drush

$ cd /var/www
$ wget http://ftp.drupal.org/files/projects/drush-7.x-4.4.tar.gz
$ tar -xzf drush-7.x-4.4.tar.gz
$ ln -s /var/www/drush/drush /usr/local/bin/drush


Create a vhost location on the server for the Drupal installation.

$ mkdir /var/www/vhosts
$ cd /var/www/vhosts
$ drush dl drupal
$ mv drupal-7.0/ example.com 


Integrate the Drupal files with subversion

$ cd /var/www/vhosts/example.com
$ svn co file:///var/subversion/example.com/trunk .
$ svn add * .htaccess
$ svn commit -m "downloaded drupal"


Download the Drupal apachesolr module

# make a folder for contrib modules
$ mkdir /var/www/vhosts/example.com/sites/all/modules/contrib
$ cd /var/www/vhosts/example.com/sites/all/modules/contrib

# note: in the below command, you may be prompted to choose which version of the Solr module to install. I choose option 2 for the Supported version
$ drush dl apachesolr

# commit to subversion
$ cd /var/www/vhosts/example.com/sites/all/modules
$ svn add contrib
$ svn commit -m "added contrib folder and apachesolr module"


Setup MySQL

# start mysql
$ /etc/init.d/mysqld start

# set root password
$ /usr/bin/mysqladmin -u root password 'new-password'

# create new database, user, and set permissions
$ mysql --execute="create database db_example"
$ mysql --execute="grant all privileges on db_example.* to 'example-user'@'localhost' identified by 'some_password'"


Setup Apache vhost

$ cd /etc/httpd/conf.d

# create a new file "example.com.conf", with the contents:

NameVirtualHost *:80

<Directory /var/www/vhosts>
  AllowOverride All
</Directory>

<VirtualHost *:80>
  ServerName example.com
  DocumentRoot /var/www/vhosts/example.com
  ErrorLog logs/example.com-error_log
  CustomLog logs/example.com-access_log common
</VirtualHost>



Reset Apache file permissions. NOTE: you will need a more solid/secure configuration for this!

$ cd /var/www
$ chown -R apache.apache drush*
$ chown -R apache.apache vhosts


Start Apache

$ /etc/init.d/httpd start


Install Drupal via drush

$ cd /var/www/vhosts/example.com

# note: you can set your user 1 username, password, email, etc in the following command if desired. type "drush help si" for more install options
$ drush site-install standard --sites-subdir=example.com --db-url=mysqli://example-user:some_password@localhost/db_example


At this point, you should be able to browse to your site and it will be up and running.
Drupal Installed

Now, we move onto Tomcat and Solr!

Installing Tomcat and Java. The default Centos yum repositories provide Tomcat5. I prefer Tomcat6, so there are some extras steps below and a dependency issue I had to resolve.

# added repo file to get tomcat6:
$ cd /etc/yum.repos.d/
$ wget http://www.jpackage.org/jpackage50.repo

# install Java JDK:
$ yum install java-1.6.0-openjdk

# install tomcat6:
$ yum install tomcat6 tomcat6-admin-webapps tomcat6-webapps

# dang, dependency issue... (!)

java-1.4.2-gcj-compat-1.4.2.0-40jpp.115.x86_64 from base has depsolving problems
  --> Missing Dependency: /usr/bin/rebuild-security-providers is needed by package java-1.4.2-gcj-compat-1.4.2.0-40jpp.115.x86_64 (base)
Error: Missing Dependency: /usr/bin/rebuild-security-providers is needed by package java-1.4.2-gcj-compat-1.4.2.0-40jpp.115.x86_64 (base)
 You could try using --skip-broken to work around the problem
 You could try running: package-cleanup --problems
                        package-cleanup --dupes
                        rpm -Va --nofiles --nodigest
The program package-cleanup is found in the yum-utils package.

# Fixing dependency issue (OPTIONAL):
$ mkdir ~/downloads
$ cd ~/downloads
$ wget http://plone.lucidsolutions.co.nz/linux/centos/images/jpackage-utils-compat-el5-0.0.1-1.noarch.rpm
$ rpm -Uvh jpackage-utils-compat-el5-0.0.1-1.noarch.rpm
$ yum install tomcat6 tomcat6-admin-webapps tomcat6-webapps

# setting tomcat runlevels
$ chkconfig --level 2345 tomcat6 on

# starting tomcat
$ /etc/init.d/tomcat6 start


At this point, you should be able to access Tomcat in your browser (http://example.com:8080)
Tomcat homepage

Downloading Solr Java library.

$ cd ~/downloads
# note: you may need to choose a different mirror to download
$ wget http://www.fightrice.com/mirrors/apache//lucene/solr/1.4.1/apache-solr-1.4.1.tgz
$ tar -xzf apache-solr-1.4.1.tgz

# copy/rename solr war file into Tomcat webapps directory
$ cp ~/downloads/apache-solr-1.4.1/dist/apache-solr-1.4.1.war /var/lib/tomcat6/webapps/solr.war

# copy solr files
$ cp -r ~/downloads/apache-solr-1.4.1/example/solr/ /var/lib/tomcat6/solr/


Copying the java war file into the Tomcat webapps folder will create this directory automatically:

/var/lib/tomcat6/webapps/solr


Create Catalina config file to link war file to solr directory:

$ cd /etc/tomcat6/Catalina/localhost

# create new file: "solr.xml", with the contents:

<?xml version="1.0" encoding="UTF-8"?>
<Context docBase="/var/lib/tomcat6/webapps/solr.war" debug="0" privileged="true" allowLinking="true" crossContext="true">
<Environment name="solr/home" type="java.lang.String" value="/var/lib/tomcat6/solr" override="true" />
</Context>


Setup Tomcat admin user(s):

# edit file: /etc/tomcat6/tomcat-users.xml, ensure similar contents exist:

<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
<role rolename="admin"/>
<role rolename="manager"/>
<user username="eric" password="supersecretpassword" roles="admin,manager"/>
</tomcat-users>


Update WEB-INF/web.xml file:

# edit file: /var/lib/tomcat6/webapps/solr/WEB-INF/web.xml, update section to reflect solr path:

<env-entry>
  <env-entry-name>solr/home</env-entry-name>
  <env-entry-value>/var/lib/tomcat6/solr</env-entry-value>
  <env-entry-type>java.lang.String</env-entry-type>
</env-entry>


Copy conf files from Drupal apachesolr module into Tomcat Solr conf directory (overwrite):

$ cp /var/www/vhosts/example.com/sites/all/modules/contrib/apachesolr/protwords.txt /var/lib/tomcat6/solr/conf/
$ cp /var/www/vhosts/example.com/sites/all/modules/contrib/apachesolr/schema.xml /var/lib/tomcat6/solr/conf/
$ cp /var/www/vhosts/example.com/sites/all/modules/contrib/apachesolr/solrconfig.xml /var/lib/tomcat6/solr/conf/


Reset Tomcat permissions/ownership:

$ cd /var/lib
$ chown -R tomcat.tomcat tomcat6/


Restart Tomcat

$ /etc/init.d/tomcat6 restart


At this point, you should be able to access the solr/admin tomcat Page (http://example.com:8080/solr/admin)
Solr Admin

If things are not working well at this point, check the Tomcat logs:

/var/log/tomcat6/catalina.out

And, ensure the solr java module is listed in the Tomcat Web Application Manager: http://example.com:8080/manager/html

If all is well, you can now enable the Drupal apachesolr modules:

$ cd /var/www/vhosts/example.com
$ drush en apachesolr apachesolr_search apachesolr_taxonomy apachesolr_access --uri=example.com


Log into your Drupal site. NOTE: default account (via drush): admin/admin

Edit default Apache Solr Host Settings:
URL: http://example.com/admin/config/search/apachesolr/server/solr/edit
Change url to: http://example.com:8080/solr, and save form.

Go to Drupal search settings page:
URL: http://example.com/admin/config/search/settings
Change the default search mode to "Apache Solr search", and save form.

Now, you are ready to test the indexing and integration.

Add a new piece of content to test indexing.
# Example:
# http://example.com/node/add/article
# title: Test Article
# Body: test test test

Browse to solr index page:
URL: http://example.com/admin/config/search/apachesolr/index
Select: Index queued content, and click on Begin button
You should see a status message like: "1 item processed successfully." and "Number of documents in index: 0 (1 sent but not yet processed)"
A few minutes later, refreshing the index page should show: "Number of documents in index: 1"

Search for "test" to verify Solr results.
URL: http://example.com/search/site/test
Solr Search Results

You can also review search results via solr/admin
URL: http://example.com:8080/solr/admin/
Enter "test" in query string box and click search

Part 2, Multicore Configuration (OPTIONAL)

If you need to run multiple sites off a single Solr Tomcat installation, you can setup multicore..

Copy the multicore xml file into your solr directory:

$ cp ~/downloads/apache-solr-1.4.1/example/multicore/solr.xml /var/lib/tomcat6/solr/


Create a new directory for each multisite in the solr directory:

$ mkdir /var/lib/tomcat6/solr/example.com


Replicate the solr conf directory into the new multisite directory:

cp -r /var/lib/tomcat6/solr/conf /var/lib/tomcat6/solr/example.com/conf/


Update the solr.xml file:

# edit file: /var/lib/tomcat6/solr/solr.xml, added <core> section for each site:
<cores adminPath="/admin/cores">
  <core name="example.com" instanceDir="example.com" />
</cores>


Restart Tomcat

$ /etc/init.d/tomcat6 restart


Now, your new multicore site will be accessible here: http://example.com:8080/solr/example.com/admin/
Avatar-eric-london
Created by Eric.London on 2009-08-20
Tags:
New Comment
 
Please note: the content on this page orginates from ericlondon.com.
This morning, I encountered a PHP fatal error on my development environment. Upon further inspection, one of my third party modules (XML Sitemap) required a later version of PHP. A fresh installation of Centos 5.3 comes with version 5.1.6 of PHP. Here is an easy way to upgrade PHP to a later version by using the Utter Ramblings Yum repository.

I created a new yum repo file:

$ sudo emacs /etc/yum.repos.d/utterramblings.repo

# FILE CONTENTS - START
[utterramblings]
name=Jason's Utter Ramblings Repo
baseurl=http://www.jasonlitka.com/media/EL$releasever/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka
# FILE CONTENTS - END


Ran a yum update:

$ sudo yum update
# ...snip...
Updated: apr.i386 0:1.2.12-2.jason.1 apr-util.i386 0:1.2.12-5.jason.1 curl.i386 0:7.15.5-2.1.el5_3.5 httpd.i386 0:2.2.8-jason.3 ksh.i386 0:20080202-2.el5_3.1 mod_ssl.i386 1:2.2.8-jason.3 mysql.i386 0:5.0.58-jason.2 mysql-server.i386 0:5.0.58-jason.2 pcre.i386 0:7.6-jason.1 php.i386 0:5.2.6-jason.1 php-cli.i386 0:5.2.6-jason.1 php-common.i386 0:5.2.6-jason.1 php-gd.i386 0:5.2.6-jason.1 php-mbstring.i386 0:5.2.6-jason.1 php-mssql.i386 0:5.2.6-jason.1 php-mysql.i386 0:5.2.6-jason.1 php-odbc.i386 0:5.2.6-jason.1 php-pdo.i386 0:5.2.6-jason.1 php-pear.noarch 1:1.6.2-1.jason.1 php-xml.i386 0:5.2.6-jason.1 php-xmlrpc.i386 0:5.2.6-jason.1 subversion.i386 0:1.4.4-jason.1 tzdata.noarch 0:2009k-1.el5
Complete!


After updating all these packages, I checked out my new PHP version:

$ php -v | head -1
PHP 5.2.6 (cli) (built: May  5 2008 10:32:59) 


Now, my PHP fatal error has been resolved.

NOTE: This blog entry is a re-post of a previous article.

Avatar-eric-london
Created by Eric.London on 2009-01-08
Tags:
New Comment
 
Please note: the content on this page orginates from ericlondon.com.
I just encountered a PHP fatal error when running my cron.php:

Fatal error: Call to undefined function timezone_open() in /MYSERVERPATH/httpdocs/sites/all/modules/date/date_api.module on line 607


A quick Google search, and I found the issue is documented here. The solution is to enable the Date PHP4 module. But, this issue does not happen in our production environment, so I decided to compare PHP versions:

# on the production server:
$ php -v | head -1
PHP 5.2.8 (cli) (built: Dec  9 2008 14:03:11) 

It turns out, a fully updated installation of Centos 5.2 only supplies PHP 5.1.x. So, I decided to upgrade PHP in my development environment according to this documentation.

I created a new yum repo file:

$ sudo emacs /etc/yum.repos.d/utterramblings.repo

# FILE CONTENTS - START
[utterramblings]
name=Jason's Utter Ramblings Repo
baseurl=http://www.jasonlitka.com/media/EL$releasever/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka
# FILE CONTENTS - END


And, ran another yum update:

$ sudo yum update
# ...snip...
Resolving Dependencies
# ...snip...
Dependencies Resolved

=============================================================================
 Package                 Arch       Version          Repository        Size 
=============================================================================
Updating:
 apr                     i386       1.2.12-2.jason.1  utterramblings    257 k
 apr-util                i386       1.2.12-5.jason.1  utterramblings    159 k
 httpd                   i386       2.2.8-jason.3    utterramblings    2.5 M
 mod_ssl                 i386       1:2.2.8-jason.3  utterramblings    314 k
 mysql                   i386       5.0.58-jason.2   utterramblings    6.4 M
 mysql-server            i386       5.0.58-jason.2   utterramblings     10 M
 pcre                    i386       7.6-jason.1      utterramblings    562 k
 php                     i386       5.2.6-jason.1    utterramblings    3.7 M
 php-cli                 i386       5.2.6-jason.1    utterramblings    2.6 M
 php-common              i386       5.2.6-jason.1    utterramblings    481 k
 php-devel               i386       5.2.6-jason.1    utterramblings    568 k
 php-gd                  i386       5.2.6-jason.1    utterramblings    320 k
 php-ldap                i386       5.2.6-jason.1    utterramblings     56 k
 php-mbstring            i386       5.2.6-jason.1    utterramblings    1.3 M
 php-mssql               i386       5.2.6-jason.1    utterramblings     61 k
 php-mysql               i386       5.2.6-jason.1    utterramblings    258 k
 php-odbc                i386       5.2.6-jason.1    utterramblings    112 k
 php-pdo                 i386       5.2.6-jason.1    utterramblings    159 k
 php-pear                noarch     1:1.6.2-1.jason.1  utterramblings    418 k
 php-soap                i386       5.2.6-jason.1    utterramblings    342 k
 php-xml                 i386       5.2.6-jason.1    utterramblings    316 k
 php-xmlrpc              i386       5.2.6-jason.1    utterramblings    130 k
 subversion              i386       1.4.4-jason.1    utterramblings    4.3 M

Transaction Summary
=============================================================================
Install      0 Package(s)         
Update      23 Package(s)         
Remove       0 Package(s)         

Total download size: 35 M
Is this ok [y/N]: 


After updating all these packages, I checked out my new PHP version:

$ php -v | head -1
PHP 5.2.6 (cli) (built: May  5 2008 10:32:59) 


Now, my PHP fatal error has been resolved :)