Default Vesta CP 0.9.8 comes with PHP5.4 which causes me problems on my Laravel 4.2 website.
How can i upgrade php version of self hosted Vesta CP from 5.4 to latest 5.6 ?
Default PHP version of vesta CP 0.9.8 is PHP5.4
First stop your web server
If NGINX
service nginx stop
If Apache
service httpd stop
Then remove php
yum remove php -y
Add related repositories
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm
enabling remi for 'remi' and 'remi-php56'
nano /etc/yum.repos.d/remi.repo and change the enabled value from 0 to 1
Install php56
yum install php php-bcmath php-cli php-common php-gd php-imap php-mbstring php-mcrypt php-mysql php-pdo php-soap php-tidy php-xml php-xmlrpc php-pecl-apc phpMyAdmin roundcubemail php-opcache php-xdebug -y
reset the links
mv -f /etc/roundcubemail/db.inc.php.rpmsave /etc/roundcubemail/db.inc.php
mv -f /etc/roundcubemail/main.inc.php.rpmsave /etc/roundcubemail/main.inc.php
mv -f /etc/phpMyAdmin/config.inc.php.rpmsave /etc/phpMyAdmin/config.inc.php
Start your web server.
This worked on my server.
Originally taken from here.
I use this command and it's working fine on centos 6
rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm
yum install yum-plugin-replace
yum replace php-common --replace-with=php56w-common
Related
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/
I have installed PHP 7 on Ubuntu:
php -v
PHP 7.0.5-2+deb.sury.org~trusty+1 (cli) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
It appears that right version is loaded:
php -i | grep "Loaded Configuration File"
Loaded Configuration File => /etc/php/7.0/cli/php.ini
However phpinfo() still reports old version:
PHP Version 5.5.9-1ubuntu4.14
How do I change it?
Thanks!
This is OS version:
lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04.4 LTS
Release: 14.04
Codename: trusty
I am trying to run latest Magento 2 from Git
for enabling php5 to php 7 after install
sudo a2dismod php5.6
sudo a2enmod php7.0
sudo service apache2 restart
for enabling php7 to php 5 after install
sudo a2dismod php7.0
sudo a2enmod php5.6
sudo service apache2 restart
I was wondering the same thing while working on different versions of Silverstripe...
Dhivin's answer was very close, but was missing out a couple of extra changes for PHP CLI. The lines that worked for me were:
From PHP 7.0 to 5.6
sudo update-alternatives --set php /usr/bin/php5.6
From PHP 5.6 to 7.0
sudo update-alternatives --set php /usr/bin/php7.0
Add the above lines to Dhivin's answer, and it should work for you :).
To install PHP 7 on Ubuntu 14, enter the following commands in the order shown:
sudo apt-get -y update
sudo add-apt-repository ppa:ondrej/php
sudo apt-get -y update
sudo apt-get install -y php7.0 libapache2-mod-php7.0 php7.0 php7.0-common php7.0-gd php7.0-mysql php7.0-mcrypt php7.0-curl php7.0-intl php7.0-xsl php7.0-mbstring php7.0-zip php7.0-bcmath php7.0-iconv
Enter the following command to verify PHP 7 installed properly:
php -v
From PHP 5.6 To PHP 7.1
$ sudo a2dismod php5.6
$ sudo a2enmod php7.1
$ sudo service apache2 restart
$ update-alternatives --set php /usr/bin/php7.1
From PHP 7.1 to PHP 5.6
$ sudo a2dismod php7.1
$ sudo a2enmod php5.6
$ sudo service apache2 restart
$ sudo update-alternatives --set php /usr/bin/php5.6
You can purge all php and install new
sudo aptitude purge dpkg -l | grep php| awk '{print $2}' |tr "\n" " "
or just disable unnecessary php module and enable php7
see there https://stackoverflow.com/a/38230807/1893211
I am using CentOS 7.2.
I would like to install the latest version of rsync - rsync-3.1.2,
rsync-3.0.9 is on system, installed when installing mariadb with yum,
# rpm -qa |grep rsync
rsync-3.0.9-17.el7.x86_64
removing rsync-3.0.9 first,
# yum remove rsync
rsync and mariadb were removed together,
then,
installing rsync-3.1.2 from source code,
# wget https://download.samba.org/pub/rsync/src/rsync-3.1.2.tar.gz
# tar -zxvf rsync-3.1.2.tar.gz
# cd rsync-3.1.2
# ./configure
# make
# make install
then,
installing mariadb with yum again,
but rsync-3.0.9 will still be installed.
How can I solve the problem?
You can install rsync 3.1.2 from the Fedora 24 .rpm package:
wget http://dl.fedoraproject.org/pub/fedora/linux/releases/24/Everything/x86_64/os/Packages/r/rsync-3.1.2-2.fc24.x86_64.rpm
rpm -Uvh rsync-3.1.2-2.fc24.x86_64.rpm
(but that question doesn't really belong to stackoverflow)
You can install rsync 3.1.2 from the gf-plus repo. Just follow the steps below:
Install the gf-release package.
sudo rpm -Uvh http://mirror.ghettoforge.org/distributions/gf/el/7/gf/x86_64/gf-release-7-10.gf.el7.noarch.rpm
Upgrade rsync package from the gf-plus repo.
sudo yum install -y --enablerepo=gf-plus rsync
Check rsync version.
hash -r; rsync --version | awk 'NR==1 {print $3}'
If it prints 3.1.2, rsync is upgraded.
By default, only the gf repo is enabled, which claims that it "won't overwrite core distro packages". You can disable it:
sudo yum-config-manager --disable gf
(For command not found error, run sudo yum install -y yum-utils and try again.)
Or simply remove all the gf* repos by removing the gf-release package:
sudo yum remove -y gf-release
You either need to install all of your software using packages, or install all of your software from source. Trying to mix and match is going to lead to exactly the sort of problem you are experiencing here: the mariadb package has a dependency on rsync, but the package manager doesn't know anything about the files you have installed from source.
The correct way to solve this problem is to build your own rsync package that can then be installed with yum. You can start with the source package for your distribution and then modify it for 3.1.2. You may be able to utilize a more recent package (e.g., from Fedora) and rebuild it for your system.
You can find the source RPM for rsync-3.0.9 here, and there is some documentation that will hopefully help you get started here.
I want to install the latest PHP 7.0 on an AWS EC2 T2.Micro Instance. So far I have read that currently AWS do not support PHP 7. But hey.. This is just a virtual server in the cloud with me having the full control over its configuration, so there must be some way to get PHP 7 running on this one.
Any help much appreciated.
My box is as below
$ cat /etc/*-release
---------------------------------------
NAME="Amazon Linux AMI"
VERSION="2015.09"
ID="amzn"
ID_LIKE="rhel fedora"
VERSION_ID="2015.09"
PRETTY_NAME="Amazon Linux AMI 2015.09"
ANSI_COLOR="0;33"
CPE_NAME="[*not significant*]"
HOME_URL="http://aws.amazon.com/amazon-linux-ami/"
Amazon Linux AMI release 2015.09
$ uname -a
---------------------------------------
Linux ip-xxx-xxx-xxx-xxx 4.1.13-18.26.amzn1.x86_64 #1 [date] x86_64 x86_64 x86_64 GNU/Linux
$ uname -mrs
---------------------------------------
Linux 4.1.13-18.26.amzn1.x86_64 x86_64
$ cat /proc/version
---------------------------------------
Linux version 4.1.13-18.26.amzn1.x86_64 (mockbuild#gobi-build-64010) (gcc version 4.8.3 20140911 (Red Hat 4.8.3-9) (GCC) )
You can now use the official php7 packages. Here an easy to follow guide.
1. Install Apache 2.4 and PHP 7.0 on Amazon Linux AMI
# Remove current apache & php
sudo yum remove httpd* php*
# Install Apache 2.4
sudo yum install httpd24
# Install PHP 7.0
# automatically includes php70-cli php70-common php70-json php70-process php70-xml
sudo yum install php70
# Install additional commonly used php packages
sudo yum install php70-gd
sudo yum install php70-imap
sudo yum install php70-mbstring
sudo yum install php70-mysqlnd
sudo yum install php70-opcache
sudo yum install php70-pdo
sudo yum install php70-pecl-apcu
2. Modify DirectoryIndex to include index.php
sudo nano /etc/httpd/conf/httpd.conf
find this:
<IfModule dir_module>
DirectoryIndex index.html
</IfModule>
and modify it to look like this:
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>
If a directory contains an index.html and an index.php, the server will serve the index.html with this setup. If you do not want that to happen, you have the following options:
Reverse the order, so index.php is served when both files exist:
<IfModule dir_module>
DirectoryIndex index.php index.html
</IfModule>
Only use index.php as the DirectoryIndex:
<IfModule dir_module>
DirectoryIndex index.php
</IfModule>
3. Start the Apache web server
sudo service httpd start
4. Configure the Apache web server to start at each system boot
sudo chkconfig httpd on
5. Test your installation
Create phpinfo.php:
echo '<?php print phpinfo();' | sudo tee --append /var/www/html/phpinfo.php
Open your browser and enter your instance's public IP in the address bar followed by /phpinfo.php
Example: http://xxx.xxx.xxx.xxx/phpinfo.php
Note: Don't forget to allow incoming connections for HTTP (port 80) in the Security Groups of your instance, else your request will time out.
I got this running on my instance. You need http2.2 for it to work with the webtatic repo. I had so many repos there were a bunch of different version incompatibilities. I didn't keep great notes but looking at my history I basically did this:
# Remove current php & apache
sudo service httpd stop
sudo yum remove httpd* php*
# Remove any third party repos that aren't relevant
sudo yum repolist
sudo yum remove remi-safe
# Install Standard Apache for Amazon AMI
sudo yum install httpd #specify http22 if you get a different version
# Download webtatic
mkdir -p /tmp/php7
cd /tmp/php7
wget https://mirror.webtatic.com/yum/el6/latest.rpm
# Install webtatic repo
sudo yum install latest.rpm
sudo vi /etc/yum.repos.d/webtatic.repo 'set repo enables
sudo yum clean all
# Install base php7
sudo yum install --enablerepo=webtatic php70w
php -v #Should say something like PHP 7.0.2 (cli) (built: Jan 9 2016 16:09:32) ( NTS )
sudo yum install php70w-opcache
sudo yum install php70w-xml
sudo yum install php70w-pdo
sudo yum install php70w-mysqlnd
sudo yum install php70w-gd
sudo yum install php70w-apcu
sudo yum install php70w-pecl-apcu
sudo yum install php70w-mbstring
sudo yum install php70w-imap
# Restart apache
sudo service httpd restart
Current answer to problem (not original version in question) - worth knowing since this is a bit simpler and php7 isn't available in the standard repos for Amazon Linux 2, and this didn't come up until I searched a bit harder:
amazon-linux-extras install php7.2
The version of extras can be checked with a list command if v7.2 is no longer current:
amazon-linux-extras list
There are now official php7 packages for aws linux as of July 14, 2016. See the announcement at https://forums.aws.amazon.com/ann.jspa?annID=3902
To list available packages, run yum list php70*
The other answers seem to only work with Apache 2.2 but not 2.4.
Here's how I installed php7 on Amazon Linux running Apache 2.4:
First, if php is already installed, then remove it:
sudo yum remove php5*
Take note of the php5 packages that are being removed as you'll need to install the php7 versions of them. The php7 package names have a fairly direct and unambiguous mapping from their php5 counterparts as you'll see below. The rest of the instructions cover a classic LAMP stack and may be sufficient for your use-case.
Using instructions from http://www.spidersoft.com.au/2015/php-7-on-ami-linux-ec2/
wget http://mirrors.mediatemple.net/remi/enterprise/remi-release-6.rpm
sudo yum install remi-release-6.rpm
edit /etc/yum.repos.d/epel.repo and set enabled=1
sudo yum upgrade -y
sudo yum install php70 php70-php-fpm php70-php-xml php70-php-pdo php70-php-mysqlnd php70-php-gd php70-php-pecl-apcu php70-php-mbstring php70-php-mcrypt php70-php-opcache
Now you should have php70-php-fpm installed, which you can use in conjunction with apache:
Start the fpm daemon:
sudo service php70-php-fpm start
Switch Apache from prefork to mpm event worker (this is required because mod_php isn't thread safe) in /etc/httpd/conf.modules.d/00-mpm.conf:
LoadModule mpm_event_module modules/mod_mpm_event.so
Instruct apache to pass all php requests to php-fpm by adding the following lines in /etc/httpd/conf/httpd.conf
<FilesMatch \.php$>
SetHandler "proxy:fcgi://127.0.0.1:9000"
</FilesMatch>
DirectoryIndex /index.php index.php
Restart apache using sudo service httpd restart. If everything went ok you should be able to verify the installation by requesting a php file containing phpinfo().
If you have existing shell scripts that use php's cli interpreter and thus start with #!/usr/bin/php, you have to set up a symlink to /usr/bin/php since the binary is now named /usr/bin/php70. You can do this as follows:
sudo ln -s /usr/bin/php70 /usr/bin/php
For more info on how to configure php-fpm see https://wiki.apache.org/httpd/PHP-FPM
I was installing PHP 7.0 on a production box that already has apache 2.4 and PHP 5.5. I wanted to install PHP 7.0 alongside it in a way that would have no Server outage. This is what I did.
# Install PHP 7.0
# automatically includes php70-cli php70-common php70-json php70-process php70-xml
sudo yum install php70
# Install additional commonly used php packages
sudo yum install php70-gd
sudo yum install php70-imap
sudo yum install php70-mbstring
sudo yum install php70-mysqlnd
sudo yum install php70-opcache
sudo yum install php70-pecl-apcu
This happily installed PHP 7 alongside PHP 5.5. The trick was to tell apache to use 7.0. I'm not sure if this was the best way, but I achieved this by changing these 2 permalinks:
ln -sf /etc/httpd/conf.d/php-conf.7.0 /etc/alternatives/php.conf
ln -sf /etc/httpd/conf.modules.d/15-php-conf.7.0 /etc/alternatives/10-php.conf
At this point apache is still happily running 5.5. Then when you restart apache it should be working with 7.0 (maybe 7.0.1). This is the no downtime way. I'd still recommend doing what I did, which is to rebuild PROD on another instance (create a TEST server) and test it all once before actually doing it on PROD. Good luck!
Oh, and right now the php command will still run 5.5. You can either change any scripts or CRON jobs to point to php7 or change the default version by running
alternatives --config php
It's simple. Just:
sudo amazon-linux-extras install -y php7.2
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/install-LAMP.html
can follow this step-by-step guide for LAMP installation
sudo yum update -y
sudo yum install -y httpd24 php70 mysql56-server php70-mysqlnd
sudo service httpd start
If you want a quick copy-paste install:
wget http://mirrors.mediatemple.net/remi/enterprise/remi-release-6.rpm
sudo yum install -y remi-release-6.rpm
sudo yum update -y
sudo yum install -y --enablerepo=epel php70
Test with:
php70 -v
And if you want the executable to be php:
ln -s /usr/bin/php70 /usr/local/bin/php
php -v
This thread helped me get close enough to finish it off, I'm sharing the commands and output that worked for me.
On Amazon Lightsail with Amazon Linux (amzn1.x86_64), the following command list helped me rid the system of Apache 2.2 and PHP 5.3 to get to Apache 2.4 and PHP:
Remove the current version of php and related tools:
sudo yum remove php*
==============================================================================================================================================
Package Arch Version Repository Size
==============================================================================================================================================
Removing:
php x86_64 5.3.29-1.8.amzn1 #amzn-main 7.4 M
php-cli x86_64 5.3.29-1.8.amzn1 #amzn-main 6.4 M
php-common x86_64 5.3.29-1.8.amzn1 #amzn-main 6.3 M
php-devel x86_64 5.3.29-1.8.amzn1 #amzn-main 9.9 M
php-gd x86_64 5.3.29-1.8.amzn1 #amzn-main 669 k
php-mbstring x86_64 5.3.29-1.8.amzn1 #amzn-main 4.1 M
php-mcrypt x86_64 5.3.29-1.8.amzn1 #amzn-main 92 k
php-mysql x86_64 5.3.29-1.8.amzn1 #amzn-main 445 k
php-pdo x86_64 5.3.29-1.8.amzn1 #amzn-main 381 k
php-xml x86_64 5.3.29-1.8.amzn1 #amzn-main 625 k
Transaction Summary
==============================================================================================================================================
Remove 10 Packages
Remove the current version of Apache (note you should backup your conf and conf.d folder before doing this, imho; in my case, it was a new system setup so there was nothing of interest there):
sudo yum remove http*
==============================================================================================================================================
Package Arch Version Repository Size
==============================================================================================================================================
Removing:
httpd x86_64 2.2.31-1.8.amzn1 #amzn-main 3.0 M
httpd-devel x86_64 2.2.31-1.8.amzn1 #amzn-main 534 k
httpd-tools x86_64 2.2.31-1.8.amzn1 #amzn-main 135 k
Transaction Summary
==============================================================================================================================================
Remove 3 Packages
Install Apache 2.4 (and start Apache)
sudo yum install httpd24.x86_64
sudo service httpd start
Install PHP 7
sudo yum install php70
==============================================================================================================================================
Package Arch Version Repository Size
==============================================================================================================================================
Installing:
php70 x86_64 7.0.13-1.19.amzn1 amzn-updates 3.3 M
Installing for dependencies:
php70-cli x86_64 7.0.13-1.19.amzn1 amzn-updates 4.7 M
php70-common x86_64 7.0.13-1.19.amzn1 amzn-updates 1.2 M
php70-json x86_64 7.0.13-1.19.amzn1 amzn-updates 65 k
php70-process x86_64 7.0.13-1.19.amzn1 amzn-updates 79 k
php70-xml x86_64 7.0.13-1.19.amzn1 amzn-updates 309 k
Transaction Summary
==============================================================================================================================================
Install 1 Package (+5 Dependent packages)
Total download size: 9.6 M
Installed size: 31 M
Is this ok [y/d/N]: y
Downloading packages:
(1/6): php70-7.0.13-1.19.amzn1.x86_64.rpm | 3.3 MB 00:00
(2/6): php70-cli-7.0.13-1.19.amzn1.x86_64.rpm | 4.7 MB 00:00
(3/6): php70-common-7.0.13-1.19.amzn1.x86_64.rpm | 1.2 MB 00:00
(4/6): php70-json-7.0.13-1.19.amzn1.x86_64.rpm | 65 kB 00:00
(5/6): php70-process-7.0.13-1.19.amzn1.x86_64.rpm | 79 kB 00:00
(6/6): php70-xml-7.0.13-1.19.amzn1.x86_64.rpm | 309 kB 00:00
----------------------------------------------------------------------------------------------------------------------------------------------
Total 14 MB/s | 9.6 MB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : php70-json-7.0.13-1.19.amzn1.x86_64 1/6
Installing : php70-process-7.0.13-1.19.amzn1.x86_64 2/6
Installing : php70-xml-7.0.13-1.19.amzn1.x86_64 3/6
Installing : php70-cli-7.0.13-1.19.amzn1.x86_64 4/6
Installing : php70-common-7.0.13-1.19.amzn1.x86_64 5/6
Installing : php70-7.0.13-1.19.amzn1.x86_64 6/6
Verifying : php70-7.0.13-1.19.amzn1.x86_64 1/6
Verifying : php70-common-7.0.13-1.19.amzn1.x86_64 2/6
Verifying : php70-json-7.0.13-1.19.amzn1.x86_64 3/6
Verifying : php70-process-7.0.13-1.19.amzn1.x86_64 4/6
Verifying : php70-xml-7.0.13-1.19.amzn1.x86_64 5/6
Verifying : php70-cli-7.0.13-1.19.amzn1.x86_64 6/6
Installed:
php70.x86_64 0:7.0.13-1.19.amzn1
Dependency Installed:
php70-cli.x86_64 0:7.0.13-1.19.amzn1 php70-common.x86_64 0:7.0.13-1.19.amzn1 php70-json.x86_64 0:7.0.13-1.19.amzn1
php70-process.x86_64 0:7.0.13-1.19.amzn1 php70-xml.x86_64 0:7.0.13-1.19.amzn1
Complete!
The php 7 package name is php70w. So what you can do is, install a Webtatic repo on you linux machine and install it from there.
rpm -ivh https://mirror.webtatic.com/yum/el6/latest.rpm
yum clean all
yum install --enablerepo=webtatic php70w
By default, just few Yum Repo is enabled on RedHat EC2.
To enable all, just type
yum-config-manager --enable rhui-REGION-rhel-*
and do a yum list now, you should be able to see this:
yum list |grep php7
Several answers should work here; however, when I was installing mine, it would not render pages and would display text instead of rendered PHP.
To fix that, I ran
sudo yum install php70-php-fpm
After that, everything started working.
Here is how I installed PHP 7.1 on Amazon Linux:
wget http://rpms.remirepo.net/enterprise/remi-release-6.rpm
rpm -Uvh remi-release-6.rpm epel-release-latest-6.noarch.rpm
yum-config-manager --enable remi-php71
wget ftp://195.220.108.108/linux/epel/6/x86_64/Packages/s/scl-utils-20120229-1.el6.x86_64.rpm
rpm -Uvh scl-utils-20120229-1.el6.x86_64.rpm
yum install php71
https://gist.github.com/ihor/581d169886c29e7e17d01b0041167b01
Nodejs version 4 has been released and installed on my windows machine.
I'm trying to install the package trough yum on redhat but i'm not getting the latest version.
i tried: sudo yum install -y nodejs but the lastest 4.0 version is not installed.
How do i install nodejs 4.0 on a redhat machine?
NodeJS 4.X for EL7 repos located at https://rpm.nodesource.com/pub_4.x/el/7/
To install with yum change baseurl in nodesource-el.repo file to:
baseurl=https://rpm.nodesource.com/pub_4.x/el/7/$basearch
/etc/yum.repos.d/nodesource-el.repo content:
[nodesource]
name=Node.js Packages for Enterprise Linux 7 - $basearch
baseurl=https://rpm.nodesource.com/pub_4.x/el/7/$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/NODESOURCE-GPG-SIGNING-KEY-EL
[nodesource-source]
name=Node.js for Enterprise Linux 7 - $basearch - Source
baseurl=https://rpm.nodesource.com/pub_4.x/el/7/SRPMS
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/NODESOURCE-GPG-SIGNING-KEY-EL
gpgcheck=1
You can compile and install from its source.
ver=4.0.0
wget -c https://nodejs.org/dist/v$ver/node-v$ver.tar.gz #This is to download the source code.
tar -xzf node-v$ver.tar.gz
cd node-v$ver
./configure && make && sudo make install
https://github.com/nodejs/node-v0.x-archive/wiki/Installation
Try npm install n -g and then n latest for downloading it with this version manager.
Edit:
The official distributions are managed by Nodesource. For RHEL the setup is supposed to be (take from the repo):
Current instructions for installing, as listed on the Node.js Wiki:
Note that the Node.js packages for EL 5 (RHEL5 and CentOS 5) depend on the EPEL repository being available. The setup script will check and provide instructions if it is not installed.
Run as root on RHEL, CentOS, CloudLinux or Fedora:
curl -sL https://rpm.nodesource.com/setup | bash -
Then install, as root:
yum install -y nodejs
But be aware that 4.0 is currently not in their rpm distribution
This was my solution and it worked:
Distrubution url: Distr: https://nodejs.org/dist/v4.2.1/node-v4.2.1.tar.gz (v4.2.1 for now)
Unpack the package (tar Jxf node-v4.2.1.tar.xz).
Some package could be too old and will cause problems during installation.
cd to the unpacked file and run ”./configure”. if the warming “C++ compiler too old, need g++ 4.8 or clang++ 3.4” is displayed you need to execute the following commands:
curl http://linuxsoft.cern.ch/cern/scl/slc6-scl.repo > /etc/yum.repos.d/slc6-scl.repo
rpm --import http://ftp.mirrorservice.org/sites/ftp.scientificlinux.org/linux/scientific/51/i386/RPM-GPG-KEYs/RPM-GPG-KEY-cern
yum install -y devtoolset-3
And to utilize it without having to set environment variables execute this command:
scl enable devtoolset-3 bash
Now restart the process:
./configure
make
make install
You can try this solution.
First, update software repository to the latest versions:
yum -y update
Intall "Development Tools". It's a group of tools for compiling software from sources.
yum -y groupinstall "Development Tools"
Move to /usr/src directory - the usual place to hold software sources.
cd /usr/src
Now, we pick the latest compressed source archive from Node.js website at http://nodejs.org/download/.
wget http://nodejs.org/dist/v4.2.4/node-v4.2.4.tar.gz
tar zxf node-v4.2.4.tar.gz
cd node-v4.2.4
./configure
make
make install