Skip to content

Instantly share code, notes, and snippets.

@gnud
Last active July 13, 2019 12:23
Show Gist options
  • Save gnud/513178f7d1eef2e6b4ea916c056fa1e3 to your computer and use it in GitHub Desktop.
Save gnud/513178f7d1eef2e6b4ea916c056fa1e3 to your computer and use it in GitHub Desktop.
gnud machine for LAMP + MEAN.JS development + Apache User's mod compatible

OS related

apt install curl git build-essential

Essentials

apt install libnotify-bin

nvm setup

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.1/install.sh | bash

Restart terminal (by opening new terminal) (Make sure you are not logged as root or use sudo)

Install default node

nvm install v8.9.4

Angular

npm install angular-cli -g
npm install node-sass -g

Troubleshoot

In case ng serve says it's not a valid angular project, try this:

npm uninstall -g angular-cli @angular/cli
npm cache clean --force
npm install npm@latest -g
npm install -g @angular/cli

WebStorm

  • Open project's directory
  • Go to WebStorm settings in Languages & Frameworks -> Node.js and NPM; select node js interpretor from the dropdown to v8.9.4 one.
  • Edit Run/Debug configurations and create npm launcher, with command Run and script start. Make sure interpretor is set to project.
  • If you want to debug Angular code, open Edit Run/Debug configurations and create JavaScript Debug launcher, set URL https://localhost:4200/

The user mod is an Apache module dedicated to serve public_html for each GNU/Linux user. To access someones user public_html we use httpp://myserver.com/~USERNAME

Reference

http://www.techytalk.info/enable-userdir-apache-module-ubuntu-debian-based-linux-distributions/

Enable PHP for users

As stated edit your php*.conf configuration file, usually found at /etc/apache2/mods-available/php*.conf.

Edit the file, comment in or delete the lines to exclude the default PHP engine disable.

Restart/reload the Apache service.

Having public_html for users ready

https://gist.github.com/gnud/01b4241d7b94c3ddf9faac479183199b

apt install filezilla pac manager - GUI ssh manager dukto rc - clipboard + file/folder share in LAN/internet firefox nightly aurora sublime - after that associate every text based file with Sublime, to avoid data loss

Docker machine

Follow guide at here

base=https://github.com/docker/machine/releases/download/v0.16.0 &&
  curl -L $base/docker-machine-$(uname -s)-$(uname -m) >/tmp/docker-machine &&
  sudo install /tmp/docker-machine /usr/local/bin/docker-machine
  sudo chmod +x /usr/local/bin/docker-machine

Docker CE

Follow guide at here

sudo apt-get update

sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    software-properties-common
    
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
   
sudo apt-key fingerprint 0EBFCD88

sudo add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) \
   stable"
   
sudo apt-get update

sudo apt-get install docker-ce

User accesible docker

usermod -aG docker $USER

Replace $USER with the user of your choice, that will use docker.

Docker compose

Follow guide at here.

sudo curl -L "https://github.com/docker/compose/releases/download/1.23.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

sudo chmod +x /usr/local/bin/docker-compose
# Base packages
sudo apt install git curl
# Python packages
sudo apt install python2-dev python3-dev virtualenv
# Nginx packages
sudo apt-get install nginx

Essentials

apt install curl

Install LAMP stack

apt install apache2 mysql-server php libapache2-mod-php php-mysql php-xml php-mbstring composer

a2enmod rewrite

Install MEAN stack

Essentials

apt install libnotify-bin

nvm setup

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.1/install.sh | bash

Put this in .bashrc

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm

in new Bash tab

nvm ls-remote # this list all node versions, choose the latest LTS
nvm install v6.10.1
npm install gulp-cli -g # for gulp support
npm install -g gulp-notify
npm install -g gulp-cli
npm install -g bower
npm install node-sass

Migrate MySQL

cd /var/lib/mysql/
cp -r /media/damjan/DarkRacer/DL1/var/lib/mysql/* .
chown mysql:mysql -R .
systemctl restart mysql
mysql -uroot -ppassword

Migrate Apache

cp /media/damjan/DarkRacer/DL1/etc/hosts /etc/
cp /media/damjan/DarkRacer/DL1/etc/apache2/sites-available/* /etc/apache2/sites-available/
for s in /etc/apache2/sites-available/; do a2ensite $s; done
systemctl restart apache2

Essentials

sudo yum install git

Install LAMP stack

MySQL

curl http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm > mysql-community-release-el7-5.noarch.rpm sudo rpm -ivh mysql-community-release-el7-5.noarch.rpm sudo yum install mysql-server -y sudo systemctl start mysql

Development

sudo yum install gcc gcc-c++ make -y

Extras

Telnet

sudo yum install telnet -y

Net cat

sudo yum install nmap-ncat -y sudo ncat -l 80 # start a loop TCP socket

Firewall

sudo firewall-cmd --zone=public --add-port=80/tcp --permanent sudo firewall-cmd --reload

wp-config.php

Edit your wp-config.php by appending these lines

define('WP_HOME','http://1.1.1.1/~myusr');
define('WP_SITEURL','http://1.1.1.1/~myusr');
define( 'WP_DEBUG', false );

Import your MySQL database

Extract or git clone your wp installation in user's public_html

For more info: https://gist.github.com/gnud/01b4241d7b94c3ddf9faac479183199b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment