Upgrade to php 7 and apache 2.4 from php 5.3 and apache 2.2 in Amazon EC2 - linux

I have a legacy system in which Apache 2.2.34 (linux) is installed along with php 5.3.29 (CLI).
I just want to upgrade my apache to 2.4.x so that I will be able to use php 7.
I have tried searching for the same but majority of sites provide solution for CentOS or Ubuntu. I'm new to Linux so I'm a bit confused when applying the same on Amazon EC2 instance.
That would be really helpful if someone can provide me a step by step process to do the upgrade process. I just need to upgrade the server and I can do the configuration accordingly.

After some more googling, I have found the steps I have taken to upgrade. Hope that helps anyone looking for the same:
Login to your Linux instance and perform the regular system updates first
$ sudo yum update
Stop the running web server
$ sudo service httpd stop
Create backup of the existing httpd by using command:
$ sudo cp -a /etc/httpd /etc/httpd.bak
Remove any existing PHP packages
$ sudo yum remove php*
Remove old web server installs
$ sudo yum remove httpd*
Update yum package repository
$ sudo yum clean all
$ sudo yum upgrade -y
Install Apache 2.4
$ sudo yum install httpd24
Install PHP 7 packages
$ sudo yum install php70 php70-mysqlnd php70-imap php70-pecl-memcache php70-pecl-apcu php70-gd
Install a new version of mod_ssl
$ sudo yum install mod24_ssl
I also needed to reconfigure /etc/httpd/conf/httpd.conf and /etc/httpd/conf.d/ssl.conf in order to enable SSL and pretty permalinks.
Finally all I needed to do is start my web server
$ service httpd start
That's it.

Do retain that the solution by MrGoogle will reset any configuration in existence in the hpptd service.
You will probably need to reconfigure some settings...
I had to reconfigure mod_rewrite and .htaccess File for apache:
https://devops.ionos.com/tutorials/install-and-configure-mod_rewrite-for-apache-on-centos-7/

Related

My codeIgniter 3 project is not working no ubuntu 22.04 where as same project perfect working on window

My codeIgniter 3 project is not working no ubuntu 22.04 where as same project perfect working on window..
and i now download codeIgniter 3 new project it perfectly showing the default page but not show other pages which i created
this project is on xampp server
just what do load the project other pages
Because on your local server you haven't installed php and its supporting extensions like intl extension and mbstring
You need to try installing the extension.
$ sudo add-apt-repository ppa:ondrej/php
$ sudo apt update
$ sudo apt upgrade
$ sudo apt install -y php5.6
The software will then be installed on your system.
In order to check the version number of your installed PHP, run the following command:
$ php -v
Now you have PHP 5.6 installed, but most use cases require that you install additional PHP modules like MySQL support, Curl, GD, etc. Run the below command to install some commonly used modules.
$ apt-get install php5.6-gd php5.6-mysql php5.6-imap php5.6-curl php5.6-intl php5.6-pspell php5.6-recode php5.6-sqlite3 php5.6-tidy php5.6-xmlrpc php5.6-xsl php5.6-zip php5.6-mbstring php5.6-soap php5.6-opcache libicu65 php5.6-common php5.6-json php5.6-readline php5.6-xml
I hope this helps

Reset Realm Object Server on Linux

Can I ask that are there any scripts in Linux that similar to reset-server-realms.command on Mac that can delete all realms on server. Actually I need to reset the server and clean it before use the application officially. I try to uninstall regarding to the guides on Realm website but somehow the old data still comes up.
Thanks
Uninstalling the package doesn't remove any data. This is done on purpose, so that the upgrade process of RPMs and debs works properly.
We don't provide a script, but the easiest way to wipe everything is simply to run:
sudo rm -rf /var/lib/realm
# CentOS
sudo yum remove realm-object-server-de
sudo yum install realm-object-server-de
# Ubuntu
sudo apt-get install --reinstall realm-object-server-de
Please note that this will preserve your configuration, still. The configuration is stored in /etc/realm.

'No package nginx available' error CentOS 6.5

I'm trying to install nginx on CentOS 6.5, then I added these lines on file /etc/yum.repos.d/nginx.repo
Then install nginx by:
And I've got a message error: No package nginx available
How can I fix it? I would greatly appreciate any help you can give me in working this problem!
nginx is not a part of base CentOS repository.
But you can install EPEL repositiry to get nginx:
yum install epel-release
and then
yum install nginx
This should work well for oraclelinux7
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum -y install nginx
Dockerfile to install nginx on oraclelinux:
FROM oraclelinux:7-slim
RUN rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
RUN yum -y install nginx && yum clean all && rm -rf /var/cache/yum
EXPOSE 80
ENTRYPOINT ["nginx", "-g", "daemon off;"]
Your repo url is having an error.
It is necessary to manually replace $releasever with either "5" (for 5.x) or "6" (for 6.x), depending upon your OS version. Similarly you have to edit the $basearch also.
After that do the following command
yum clean all
yum install nginx
An alternative option is to install the epel repository and install nginx from there.
yum install epel-release
yum clean all
yum install nginx
What worked for me (CentOS 7.1) was removing epel first:
yum remove epel-release
yum install epel-release
yum update
yum install nginx
Install nginx first! Run the following commands to first add the EPEL repository (Extra Packages for Enterprise Linux) and then install nginx.
yum install epel-release
yum install nginx
Try to disable plugins for yum:
vim /etc/yum.conf
set plugins=0, and re-install epel-release:
yum remove epel-release
yum install epel-release
yum install nginx
this works for me, good luck!
Check if it is excluded from the yum source:
Use vi /etc/yum.conf
Check the exclude option
Although the otherwise-posted advice regarding manually setting the $releasever and $basearch values in the repo file will not hurt per se (at least while you stick to the software release referred to by the values you set), it is not strictly necessary.
I also have the exact contents you have posted, in a file named /etc/yum.repos.d/nginx.repo which functions correctly without having set the above values explicitly.
My advice would be to perform a yum updateprior to attempting to install (as it's possible that when you tried to install, yum had not queried all of the repo URLs from the files in /etc/yum.repos.d/ for the latest versions of their databases). Also make absolutely sure that your created file ends in .repo as otherwise it will be ignored by yum.
Failing that, check the SElinux security contexts on the files in that directory - or just go ahead and manually restore them by running restorecon -Rv '/etc/yum.repos.d' and check the file permissions on the manually created repo file(s), which should be owned by root:root and have show 644 as file permissions. To manually amend these, run chmod 644 /etc/yum.repos.d/nginx.repoand chown root:root /etc/yum.repos.d/nginx.repo
I hope that some part of the above resolves your issues!
Check yum.conf file and it's exclude key
In addition to all above answers, Make sure nginx, httpd or any other package you want to install is not in the exclude list of yum.conf file.
Open yum.conf file located at /etc/yum.conf
Check the exclude key and remove nginx* if it's there
Then try to install your package. in this case nginx:
sudo yum install nginx

Installing phpMyAdmin on Amazon Linux

After installing phpMyAdmin on Amazon Linux using these commands...:
sudo yum --enablerepo=epel install phpmyadmin
sudo ln -s /usr/share/phpmyadmin /var/www/html/phpmyadmin
... I have tried the steps described in this tutorial (referred to in previous StackOverflow Answers), but do get the following error message after issuing the command
sudo chmod 0700 /etc/httpd/conf.d/phpmyadmin.conf: File or Directory not found.
How can I get phpMyAdmin running on Amazon Linux?
You can install phpmyadmin rpm package by yum command to enabling epel repositories
yum --enablerepo=epel install phpmyadmin
You'll then have to change the phpMyAdmin config file to allow access from your IP.
Oh and you probably need to change your sudo command to be case sensitive. Double check your filename, but on my system it would be
sudo chmod 0700 /etc/httpd/conf.d/phpMyAdmin.conf
When I first tried to install phpMyAdmin on Amazon Linux, I got some trouble; even though, I had already using epel-release options.
What I did was:
sudo yum install epel-release
sudo yum install phpmyadmin
I got error
No package phpmyadmin available.
If you got the same error you could try
sudo rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
then
sudo yum --enablerepo=remi install phpmyadmin
should works.
As previous post said, you might need update the conf of phpmyadmin on Apache for public access. After
sudo chmod 0700 /etc/httpd/conf.d/phpMyAdmin.conf
You should update the config
<IfModule !mod_authz_core.c>
# Apache 2.2
Order Deny,Allow
Allow from All
#Deny from All
#Allow from 127.0.0.1
#Allow from ::1
</IfModule>
then you should be able to access phpMyAdmin by http://domainname.com/phpMyAdmin now.
Reference:
How To Install and Secure phpMyAdmin on a CentOS 6.4 VPS
Allowing network access to PHPMyAdmin
Install phpMyAdmin 4.3.10 on Fedora 21/20, CentOS/RHEL 6.6/5.11
There's a great tutorial in the Amazon EC2 documentation that covers installing a LAMP web server stack on Amazon Linux. One of the optional procedures in that topic includes installing phpMyAdmin.

install apache2 in linux after removing old installation

while searching for installing apache web server in linux ubuntu lucid ,I found that some articles use the name apache2 while others use httpd..Is apt-get install apache2 the correct way to install?
I want to remove all of my current apache2 installation ,and install everything fresh. Should I use
sudo apt-get remove --purge apache2
I currently have apache in /etc/apache2
apache2 is Ubuntu's name for the Apache httpd version 2 branch (currently using 2.2, I think). The best source for information on Ubuntu packages is probably its own documentation; see https://help.ubuntu.com/10.04/serverguide/httpd.html. But yes, those two commands are correct.

Resources