Set SELinux To Permissive Mode on CentOS 7

ownCloud 7 on my CentOS 7 VM kept on complaining that I don’t have access to the config directory. On contrary I had both /var/www/html/owncloud/config and /var/www/html/owncloud/data directory set to drwxrwxrwx. and drwxr-x---. respectively. Yet the server complained about not having access to the config directory. Here comes the SELinux part. SELinux is by default set to enforce which we want to set to permissive more. It would be better if you create an exception rather than setting it to permissive mode but for now here is how you set up it to permissive mode.

setenforce 0

You can check the status of SELinux by running sestatus command.

SELinux status:                 enabled
SELinuxfs mount:                /sys/fs/selinux
SELinux root directory:         /etc/selinux
Loaded policy name:             targeted
Current mode:                   permissive
Mode from config file:          enforcing
Policy MLS status:              enabled
Policy deny_unknown status:     allowed
Max kernel policy version:      28

How To Enable EPEL on CentOS 7

EPEL is a repository maintained by Fedora Project which contains various additional packages for enterprise Linux distributions like Red Hat Enterprise Linux (RHEL), CentOS and Scientific Linux (SL), Oracle Enterprise Linux(OEL).

EPEL can be installed on CentOS 7 as follows.

yum install epel-release-7-0.2.noarch.rpm

You can find out more about EPEL on Fedora Project wiki

Happy Installing.

Set Firewall To Allow Access To TCP/80 Over Network From A CentOS VM

Continuing from the last two posts I was able to get the network working and set the static IP but I wasn’t able to access web server from other nodes on my network.

The two simple ways to check if your web server is accessible from your network is as follows.

  1. Python is universally installed on all Linux systems. We could use SimpleHTTPServer module for Python to check the web server. You can spun off a Python web server by running the following command.
    python -m SimpleHTTPServer 8000

Check your server at http://vm-ip-address:8000

  1. You could also install Apache web server and run it using systemd.
    yum install httpd
    systemctl start httpd

Again go to your machine’s IP address http://vm-ip-address

Now some of you might notice that server is isn’t working. At least it didn’t work on my system. CentOS 7’s firewall was blocking access to 80/tcp. You can create a rule for it as follows.

firewall-cmd --add-port=80/tcp
firewall-cmd --permanent --add-port=80/tcp

For more information please read man firewall-cmd.

Now you can access the web server on any node in your network.

How to Setup Static IP on CentOS 7?

I am working on setting my own CentOS image that I could use quickly with any sort of things that I want to learn for example install LAMP on CentOS. In this quest the next thing I want to do is setup a static IP. I am adopting @fernandoaleman‘s guide for CentOS 6 here.

Basically, we want to make changes to following three files. Remember on my system I am using ifcfg-enp0s3 and you are responsible for finding interface for your system. Also remember that VirtualBox by default uses NAT for VMs but NAT is limited to the VM but we want to access is beyond the VM. We have two other options Bridged connection or Host Only. Bridged will directly work with your network card and make it available to every terminal in your network whereas Host-only will only allow the access to the host. We want to use Bridged connection so that we can use multiple devices for our virtual server.

/etc/sysconfig/network was empty on my system so I had to just append to the file.


/etc/sysconfig/network-scripts/ifcfg-enp0s3 will require us to change ONBOOT, BOOTPROTO and add IPADDR and NETMASK. See the following example.

NAME="System enp0s3"

The last part of the puzzle is to change the DNS servers in /etc/resolv.conf. You could use either Google’s DNS or OpenDNS as follows.

# Google IPv4 nameservers

You can either restart the VM or restart the network.

systemctl restart network


How To Enable Networking At Boot On CentOS 7?

I booted up CentOS 7 x86_64 Minimal ISO in VirtualBox but it came without pre-enabled networking. According to CentOS 7 FAQ, you can easily enable networking at boot using the following command.

cd /etc/sysconfig/network-scripts/
sed -i -e 's@^ONBOOT="no@ONBOOT="yes@' ifcfg-enp0s3

Remember to make sure to edit the correct interface. In my case it was ifcfg-enp0s3 which is based on the new naming scheme of network interfaces.


I regularly change theme of this blog. I can’t seem to find a theme that fits my taste and would look fresh. Readability is so much important. The text should be of perfect size. Most of the blogs that I read tend to have 12pts text. 12pts aren’t readable from any angle. The navigation in most of the blogs and website is in such way that as soon as you click a link you get into a maze and it is hardly possible to come back where you started.

If I had a linear blog what would help users find important posts vs meta posts like this one. Posts like this one is to just satisfy myself. It is a mental exercise. It has nothing to do with users.

I am still confusing the target audience. There are two possibilities either go for a portfolio website or a blog. They can’t be the same thing. The linear nature of blog makes it hard to use.

India 68 Years Old.

Today is the Independence day of Republic of India. I have live in United States for 7 years and have recently moved to India. I am not so happy with the ground reality. There is a lot of I-am-not-sick feeling among Indians. I have long maintained a view that it is not the member of parliament or any other officer that is going to come to your street to clean it up. You live there. It is your responsibility to keep it clean. How can a billion of Indians don’t feel nothing when they walk down street and they see dirt everywhere. We don’t need policy when it comes to honk. The only way to stop noise pollution is to stop honking and stop blocking traffic.

The biggest problem is not lack of sound system but lack of motivated population to live in it. It is a common practice to leave waste outside one’s house for someone to pick up. How can in a civilized nation and cultured for centuries to expect someone to pick our wastes. It is not nice.

We worship animals from cows to goats and many but when we are done with the worship we leave them to eat polyethylene on streets.

One of the problems that we don’t seem to even think about is the problem of population. I try to leave my house whenever I think most people will be at work and I could go shop in peace but to my surprise it is always busy. It is always busy.

None of these problems are going to be solved on its own. We will have to make small groups and tackle one local problem at a time.

But crowds don’t really behave that way. Crowds are destructive.

Blog as a personal journal

I came across Sacha Chua’s Weekly Review post. The post is dauntingly truthful. It would be very fulfilling to create some sort of system to write posts like those. The essence of that post is self-reflection. I don’t think I could ever go in such a detail and also counting hours in chaotic workflow like mine would be hard.