Linux Logo

Linux – CentOS – SELinux – Cannot Start httpd – Permission to httpd.conf Denied


If 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


If 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 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


If 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


Just 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
/etc/init.d/network restart

Now your gateway should be working as expected.

Linux – CentOS – 6 – Installing Percona MySQL


If 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


Had 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.

Linux – Nginx – Config – Concate $var to string


Yesterday I ran into a situation where I had to concatenate a variable to a string within an NGinx config file. Seemed easy enough, but found it to be quite troublesome. At first I thought there may have been a special concat character, like the ‘.’ in PHP, but there isn’t, rather the concatenation construct for NGinx is similar to BASH. Check out the following example:

set $foo = 'foo';

set $foobar "${foo}_bar"; #Concatenating $foo to _bar

Linux – BASH – dos2unix – Fix Syntax Error Near Unexpected Token Messages


At work I use a mac for my development environment, and at home I use windows 7 (because I play a lot of fps / mmorpg games). I opted to use Aptana as my IDE because I wanted a consistent IDE no matter the underlying operating system, and Aptana runs on both MAC and Windows.

Last night I ran into an issue where I opened a bash file in Aptana (while on windows) and copy and pasted in some bash code from a putty session. I then saved the file and pushed to the master branch. When I went to use the file I was getting syntax errors in code that I know worked. I couldn’t figure out what it was then realized that because I saved the file in windows, the line endings were messed up. So I had to run the dos2unix converter (while on the linux box) on the file and everything worked as expected.

Just a heads up in case anyone else has the same issue.

Linux – CentOS – No acceptable C compiler found in $PATH


If 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 – ACK – Basic Usage


There are times where you may need to search for code snippets throughout your codebase, for example if you are planning on deprecating a function, or change the argument list etc. I used to use ‘fgrep’, but a friend locked me onto ‘ack’, which I find much more useful out of the two. You can find more information at ack’s website @

By default ack searches are recursive, so it’s one less flag you have to pass (vs fgrep -r), not that big of a deal, but still nice. Also ack output is easier to read and can be configured to your preferences.

Basic Search

ack 'string'

Case Insensitive Search

ack -i 'string'

Exclude Dir

There may be times where you want to exclude a dir from the search, so you don’t end up a ton of permission errors for example.

ack --ignore-dir=dir 'string'
Go to Top