Last active
July 21, 2018 12:52
-
-
Save farisshajahan/d092f958b7ca3fb87566255805b99bf9 to your computer and use it in GitHub Desktop.
Setting up OpenScholar on your Linux machine (detailed)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 1. Installing LAMP stack | |
sudo apt-get update | |
sudo apt-get install apache2 mysql-server mysql-client php libapache2-mod-php php-mysql phpmyadmin | |
# Note: A few questions are asked during the installation of phpmyadmin. Select apache2 in the first window | |
# using spacebar and use Tabspace and Return key to select options. For most questions, give the recommended | |
# option else search the Internet. | |
# 1.1 Setup MySQL | |
sudo mysql_secure_installation | |
# Give the answers you feel good about. | |
# To run mysql commands for root user without sudo, try googling. | |
# 1.2 Getting /var/www/ directory with write permissions | |
sudo usermod -a -G www-data ${USER} | |
sudo chown -R www-data:www-data /var/www | |
sudo chmod -R g+rwx /var/www | |
newgrp www-data | |
# 2. Getting additional tools for building OpenScholar | |
# 2.1 Composer | |
# 2.1.1 Installing dependencies for composer | |
sudo apt-get install curl php-cli php-mbstring git unzip | |
# 2.1.2 Getting the composer installer and installing | |
cd /tmp | |
curl -sS https://getcomposer.org/installer -o composer-setup.php | |
sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer | |
cd | |
sudo chown -R ${USER}:${USER} ~/.composer | |
# 2.2 Drush 7 | |
composer global require drush/drush:7.* | |
echo 'export PATH="$PATH:$HOME/.composer/vendor/bin/"'>> $HOME/.bashrc | |
source ~/.bashrc | |
# At this point check whether drush is working by running `drush` on the command line. If command not found, | |
# try again after running `echo 'export PATH="$PATH:/$HOME/.config/composer/vendor/bin/"' >> $HOME/.bashrc` | |
# 2.3 NPM | |
sudo apt-get install build-essential libssl-dev | |
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash - | |
sudo apt-get install -y nodejs | |
# 2.3.1 Changing behavior of NPM requiring root access for package installation | |
mkdir ~/.npm-packages | |
npm config set prefix ~/.npm-packages | |
echo "# Node Package installation using NPM without root permissions" >> ~/.bashrc | |
echo 'PATH="$HOME/.npm-packages/bin:$PATH"' >> ~/.bashrc | |
source ~/.bashrc | |
# 2.4 Bower | |
npm install -g bower | |
# 3. Download OpenScholar (latest: 3.88.8 as of 17/05/2018) | |
cd ~/Downloads | |
wget https://github.com/openscholar/openscholar/archive/SCHOLAR-3.88.8.tar.gz | |
# 4. Extract the tarball | |
tar -xf SCHOLAR-3.88.8.tar.gz | |
# Renaming the folder to openscholar | |
mv openscholar-SCHOLAR-3.88.8 openscholar | |
# 5. Building OpenScholar | |
cd ~/Downloads/openscholar | |
./scripts/build | |
# A PHP module in Drupal 7 shipped with OS 3.88.8 has a fatal error that interrupts the OpenScholar installation | |
# midway. To correct it, download the patch. | |
cd ~/Downloads/openscholar/openscholar/modules/contrib/oembed/ | |
wget https://www.drupal.org/files/oembed-2021015-1.patch | |
# Apply the patch | |
patch < oembed-2021015-1.patch | |
# 6. Move the openscholar folder to /var/www/html/ | |
cd | |
mv ~/Downloads/openscholar /var/www/html/ | |
# 7. Grant necessary write permissions for installation | |
cd /var/www/html/openscholar/www/sites | |
chmod a+w ./default | |
cd default | |
cp ./default.settings.php ./settings.php | |
chmod a+w settings.php | |
# 8. Point your webserver(Apache) to /var/www/html/openscholar/www/ | |
cd /etc/apache2/sites-available | |
sudo touch ostest.conf | |
# Open ostest.conf with sudo rights in your favourite editor and copy the contents of the ostest.conf provided here. | |
# Enable the site | |
sudo a2ensite ostest.conf | |
# Reload apache | |
sudo service apache2 restart | |
# Point the site domain name(ostest.com) to localhost | |
# Open the hosts file with sudo (/etc/hosts) and add a line | |
# 127.0.0.1 ostest.com | |
# below 127.0.0.1 localhost as shown in the attached hosts file. | |
# 9. Install the openscholar profile by visiting ostest.com/install.php on your browser | |
# 10. Go to localhost/phpmyadmin to create a new database of any name to use with OpenScholar | |
# 11. Follow the "image" instructions on https://github.com/openscholar/openscholar/wiki/Install-on-Drupal-7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
127.0.0.1 localhost | |
127.0.0.1 ostest.com | |
# The following lines are desirable for IPv6 capable hosts | |
::1 localhost ip6-localhost ip6-loopback | |
ff02::1 ip6-allnodes | |
ff02::2 ip6-allrouters |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<VirtualHost *:80> | |
ServerAdmin root@localhost | |
ServerName oscse.com | |
DocumentRoot /var/www/html/openscholar/www | |
ErrorLog ${APACHE_LOG_DIR}/error.log | |
CustomLog ${APACHE_LOG_DIR}/access.log combined | |
</VirtualHost> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Read openscholar.sh