Articles with tag - linux

Install LAMP in CentOS 7

Posted on 3 years ago by Ping Cheng

Overview

LAMP is a term that stands for Linux, Apache, MySQL and PHP. LAMP provides the basic service for the web hosting. Most website application like WordPress requires those services. This guide will list the command you need to use for LAMP installation in CentOS 7. All commands should be run in the Terminal unless specific required

Steps

Step 1 - Install Apache Service

Apache is a service that runs under Linux system to provide web service through HTTP. To install Apache, we use this command to install:

sudo yum install httpd

After installation finish, use this command to start the Apache:

sudo systemctl start httpd.service

Now your Apache service is running. To check if it is running, accessing http://localhost or http://[IP address] by Firefox. If Apache is working, Firefox would display a page with "Testing 123..." If you would like to start Apache on boot, please input this command:


sudo 

...

[ Read More ]


Fixing "You don't have permission to access / on this server"

Posted on 3 years ago by Ping Cheng

Sometimes after you installed a fresh linux system such as CentOS and implemented the LAMP on it. Then you found when you were trying to access the local web server, the web browser display some error message like "You don't have permission to access / on this server". This really ruins the day.

All the reason of this happening because the system didn't assign the proper permission for the "DocumentRoot". By the default, DocumentRoot (/var/www) is owned by user "apache" and the group "apache", but somehow some times it belongs to user "root" and user "apache" don't have permission to read and execute it. This usually also happened after you relocated your DocumentRoot path into a new directory.

To fix the issue, you need to reassign the permission to the DocumentRoot. Run the terminal and move to DocumentRoot:

$ cd /var/www

Then we are going to change the owner of directory of html:

$ sudo chown -R apache html/

After we modified the ownership o

...

[ Read More ]


Check the inodes usage on your linux server

Posted on 3 years ago by Ping Cheng

Inodes in Linux system usually describes the number of files you have in the server. Some web hosting providers set up a limitation of inodes on your hosting server. For some reasons, depending on which web application you are using, the number of inodes will grow up to an incredible number. The extra file may include emails, emails attachments, some web cache files that generated by the web application and so on.

To determine the inodes usage on your server, you can use this command to extract the inodes details for each directory. If you cannot access the hosting server physically, you can set up a ssh connection to your server.

echo "Inode usage for: $(pwd)" ; for d in `find -maxdepth 1 -type d |cut -d\/ -f2 |grep -xv . |sort`; do c=$(find $d |wc -l) ; printf "$c\t\t- $d\n" ; done ; printf "Total: \t\t$(find $(pwd) | wc -l)\n"

Hope this can solve your high inodes usage problem in your server :)

Search
Hand crafted with by Ping Cheng