Linux
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 – PHP – Apache – HTTP Error 500
0Had a weird issue where my demo server was throwing 500 error when a request was made. I spent time digging into my nginx configs to see if there were a issue, once I was able to determine it was not nginx, I started tearing apart my apache vhosts to see what the issue was. It was tough to track down because neither nginx nor apache error logs were logging anything out of the ordinary.
I came across a serverfault.com post where someone suggested using the following command after making a request:
find /var/log/ -mmin -1
This command will return any files whose modtimes are less than a minute old. When I issued the command I noticed that my PHP error log was listed, so I tailed the error log and issued another request. Sure enough, an exception was being thrown because my bootstrap file for my core library could not make a needed database connection.
Now that I was aware that an exception was causing my apache server to issue a 500 response, I still couldn’t figure out why it wasn’t outputting the exception message. I started digging around my php.ini file and found that I had set `display_errors=off`. With display_errors set to off, apache will issue a 500 response rather than output the exception, which is a good thing b/c the exception message had some database connection information.
So if you are setting up an apache/php server and it’s throwing a 500 response, check the php error log too, you may have the same setup.
Also, I read that this type of behavior will occur if the php.ini file could not be read.
Linux – CentOS6 – Git – fatal – Where do you want to fetch from today?
0If you are using GIT as your version control and you attempt to do a `git pull` and get a “fatal: Where do you want to fetch from today?” message, you need to do either of the following:
# Specify the remote repo mkdir repo cd repo && git init git pull git@github.com:user/repo.git # Or # Clone the repo mkdir repo cd repo && git clone git pull git@github.com:user/repo.git . git pull
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 – Ruby – Capistrano – GIT – No Such File or Directory – Errno::ENOENT
0If you are running capistrano to execute commands on another server and get a message that looks like:
No such file or directory - /usr/local/git/bin/git ls-remote git@github.com:user/repo.git master (Errno::ENOENT)
Be sure the user whom you are logging in as through capistrano has access to `git`. To test whether the user has access, ssh as the user and type `git`, if you get a bash error, then set the path in the user’s ~/.bash_profile. Otherwise you should see a list of git options.
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
[yaml]
NETWORKING=yes
GATEWAY=192.168.0.254
[/yaml]
/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.
Linux – CentOS – Enable Syntax Formatting for vi
0Had a weird issue last week where I tried to enable PHP formatting for vi, but it wasn’t working and took me a bit to figure out what was going on, so I wanted to blog it in case anyone else was dealing with similar issues.
By default, CentOS 5.x will install vi using vim-minimal.<arch> package, which is just vi, not actual vim. Even though you type `vi` and it says vim, it is not, it is actually vi. You can confirm this by issuing this command: `which vi`, and you will see that it points to /bin/vi.
Now that we’ve identified the problem, let’s fix it so we can enable syntax highlighting. Just follow these few extra steps:
yum install vim-common vim-enhanced
The above command will install ‘vim’. Now we need to point the vi command to it’s vim counterpart, you can do this one of two ways:
1. you can setup an alias in /etc/profile (or ~/.bash_profile)
alias vi="/usr/bin/vim"
2. or you can use a symlink:
ln -s /user/bin/vim /bin/vi
Now when you `vi` it will use vim instead, and your syntax formatting should work as expected.
