Posts tagged CentOS
Linux – CentOS – Install Mycrypt
0I have been working with Magento and came across another hurdle. Magento requires the mycrypt PHP module to be compiled, otherwise you will not be able to complete the install process. So naturally I opened up a terminal and typed `yum install mcrypt` only to find that no such libraries existed. Apparently, the default repos don’t provide the mcrypt libraries any more, so I had to use the EPEL repo, which does provide access to the required mcrypt libraries.
The following steps outline how I successfully installed mcrypt libraries on my CentOS (6.x) system:
Localize EPEL Repo
rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-5.noarch.rpm
To verify that it was installed correctly, you can type `$ -> yum repolist`
Disable EPEL Repo
I don’t like not knowing what is installed on my system, as such I didn’t want to keep the EPEL repo enabled by default. Rather, I preferred to tell YUM to use EPEL only when I directed it to do so. In order to accomplish this, you need to make the following changes:
# /etc/yum.repos.d/epel.repo enabled=1 # to enabled=0
Now, the EPEL repo will not automatically be considered when you go to install a new package. Convenient for ensuring your system stays as “vanilla” as possible.
Install Mcrypt
$ -> yum install libmcrypt libmcrypt-devel mcrypt --enablerepo=epel
The libmcrypt-devel libraries are only necessary if you are going to install the PHP mcrypt module.
The above command will install the mcrypt libraries as provided by the EPEL repo.
Configure PHP
Now that we have mcrypt installed on our system, we can compile the PHP mcrypt module, first lets find out where mcrypt was installed:
$ -> which mcrypt /usr/bin/mcrypt
Now that we know where mcrypt is installed we can add the following flag to our PHP configure for compilation: –with-mcrypt=/usr/bin
After configure be sure to run make, and make install, after they are complete you should be able to `php -m` and see mcrypt as a compiled module.
Linux – CentOS – GIT – Version Mismatch – CentOS5 CentOS6
0Be careful when upgrading CentOS 5.x servers to 6.x with respect to GIT. On CentOS 5.x GIT was not available via default repo, so I compiled it manually and it was on version 1.7.6, but when I installed CentOS 6 and did a yum install for GIT, it was at version 1.7.1.
Glad that CentOS finally provided GIT via the default repo, I let yum handle the install, but when I went to start pushing code to my production box (with git 1.7.6) I kept getting GIT failures. Only after I upgraded my production box to CentOS6 and yum installed GIT, did my code push script work again.
Linux – CentOS6 – httpd – mod_file_cache – mod_mem_cache – mod_imagemap – Cannot Load into Server – Cannot Open Shared Object
0If you are upgrading from CentOS5 to CentOS6 and attempt to start httpd, you may come across a message similar to: “Starting httpd: httpd: Syntax error on line 196 of /etc/httpd/conf/httpd.conf: Cannot load /etc/httpd/modules/mod_file_cache.so into server: /etc/httpd/modules/mod_file_cache.so: cannot open shared object file: No such file or directory”. Apparently the removal of some apache mods was an upstream decision which CentOS passed through to us. You can find more information here.
The quick fix is to remove these references from your httpd.conf file, however if you depend on these modules being available, you will have to download and compile manually.
Linux – CentOS – SELinux – Cannot Start httpd – Permission to httpd.conf Denied
0If you are attempting to start apache (httpd) and get permission denied errors, chances are your SELinux is enabled, and not configured to allow httpd connections. Use the following commands to get your httpd working.
# To view current selinux settings related to httpd: getsebool -a | fgrep -i httpd # To "pinhole" SELinux to allow httpd to start correctly: setsebool -P httpd_can_network_connect 1 setsebool -P httpd_enable_homedirs 1
Linux – CentOS6 – Ruby – It seems your ruby installation is missing psych
0If you are compiling ruby from source on a CentOS box, you may come across a “it seems your ruby installation is missing psych” message. To fix this issue you will also need to compile libyaml. If you installed libyaml to a custom directory you will need to let ruby know during configuration:
./configure --prefix=/usr/local/_custom/app/ruby --with-opt-dir=/usr/local/_custom/app/libyaml/
Now, after you have done `make && make install` you should be able to run ruby without the error message.
Linux – CentOS6 – Adding or Updating Custom Gateway
0Just started working with CentOS6 and came across an issue where I found it difficult to add a gateway for my eth0 interface. The netinstall I conducted didn’t appear to have an entry area for it (or I may have missed it). If you need to add or update your gateway do the following:
vi /etc/sysconfig/network
NETWORKING=yes GATEWAY=192.168.0.254
/etc/init.d/network restart
Now your gateway should be working as expected.
Linux – CentOS – 6 – Installing Percona MySQL
0If you are looking to install Percona MySQL on a CentOS 6 server, you will need to install the ‘Percona-Server-shared-compat.x86_64′ package, if you don’t, you will end up with errors when installing the ‘Percona-Server-server-55.x86_64′ package.
MySQL – Percona – Setting Character Sets and Collations to UTF8
0This morning I was reinstalling Percona-Server-server (v5.5.13) via Yum on my CentOS box and decided to dig into the my.cnf file a bit and make sure I had everything setup correctly. Lo and behold, I did not. I noticed that a few of my charset and collation settings were using latin1 when they should have been using UTF8.
Being a DBA newb, I tried to set server variables like ‘character_set_database’ only to see the following error messages: “110726 20:24:04 [ERROR] /usr/sbin/mysqld: unknown variable ‘character_set_database=utf8′”. I read the docs on mysql.com @ http://dev.mysql.com/doc/refman/5.5/en/server-system-variables.html#sysvar_character_set_database and couldn’t see what the problem was. It was listed as a ‘Global’ option, however if you scroll up to “Table 5.2″ you will notice that character_set_database cmd-line option is blank, which I assume means it cannot be set via the my.cnf file. I believe this setting can be set during ‘CREATE DATABASE’ commands, but I didn’t want to have to do this every time I created a database.
So I did some toying around and found the ‘character_set_server’ and ‘collation_server’ settings will actually control the children settings (database, table, etc). So all you have to do to ensure consistent utf8 for your mysql server is to add the following to your my.cnf file:
character_set_server = utf8 collation_server = utf8_general_ci
Be sure to restart the daemon, then you can issue the following commands:
# Show me collation settings mpurcell@dev1 ~ $ -> mysql -e "show variables" -u mpurcell -p | fgrep -i collat Enter password: collation_connection utf8_general_ci collation_database utf8_general_ci collation_server utf8_general_ci # Show me charset settings mpurcell@dev1 ~ $ -> mysql -e "show variables" -u mpurcell -p | fgrep -i char Enter password: character_set_client utf8 character_set_connection utf8 character_set_database utf8 character_set_filesystem binary character_set_results utf8 character_set_server utf8 character_set_system utf8 character_sets_dir /usr/share/mysql/charsets/
Now your mysql server is setup to store and collate in UTF8.
Linux – CentOS – No acceptable C compiler found in $PATH
1If you attempt to compile an application from source and run into a ‘no acceptable C compiler found in $PATH’ on a CentOS system, just run:
yum install gcc
Linux – CentOS – Unable to Set Timezone
2This morning I had a weird issue on one of my production boxes. I did a ‘date’ and noticed that the timezone was EDT, when it should be UTC. So I changed the timezone to UTC by:
rm -f /etc/localtime ln -sf /usr/share/zoneinfo/UTC /etc/localtime
Now when I did ‘date’, I still saw the timezone was EDT, when it should have been UTC. I was directed by the hosting company to reinstall the ‘tzdata’ package, so I did, and then redid the steps to change timezone:
yum reinstall tzdata rm -f /etc/localtime ln -sf /usr/share/zoneinfo/UTC /etc/localtime
Now, when I do ‘date’, it shows the correct date/time.
Just wanted to put it out there in case anyone else has the same issue.
