Step 1: Get the necessary packagesThe first step is to get the necessary packages from another CentOS system that has internet access. To install PHP 5.6 you might need to add EPEL and Remi repo. Please check the following posts to find out how to add them in your online CentOS system.
- How to install Apache, MySQL, and PHP 5.6 on CentOS 7 (LAMP)
- How to install Apache, MySQL, and PHP 5.6 on CentOS 6 (LAMP)
Now get the necessary packages with the following commands and copy them to your offline CentOS system.
yumdownloader --resolve php
repotrack -a x86_64 -p . php createrepo mysql-server
Step 2: Create a local repository in your offline CentOS system
Assuming you copies all of your packages under /tmp/rpms and you will use /home/local_repo as your local repository location. Now execute the following commands to create the repository.
mv /tmp/rpms/* /home/local_repo
chown -R root.root /home/local_repo
Now turn on the local repository creating a file /etc/yum.repos.d/local.repo with the following content.
name=CentOS - local packages
Now if you execute the following command as test, you should see PHP 5.6 package is available.
yum list php
Step 3: Install the softwares and configure
yum install httpd
yum install my-server
yum install php php-devel php-mysql
iptables -I INPUT -p tcp -m tcp --dport 80 -j ACCEPT
service iptables save