Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save abdulsec/5a4a72a568d18833a0596d8b0273acf1 to your computer and use it in GitHub Desktop.
Save abdulsec/5a4a72a568d18833a0596d8b0273acf1 to your computer and use it in GitHub Desktop.
My Manjaro Linux (GNOME) Web Development Environment Setup

Manjaro Linux (GNOME) Web Development Environment Setup

Special Thanks

rhwilr - https://gist.github.com/rhwilr/ce7338a972ef0c5585ce0c01e54bb13b#os-installation

joariasl - https://gist.github.com/joariasl/e58ca997d2581236dc56

OS

Web Development Environment


Rankmirrors to Set the Fastest Download Server

sudo pacman-mirrors -g

Update

sudo pacman -Syyu

ZSH, Oh my zsh

sudo pacman -S zsh
chsh -s /bin/zsh

sh -c "$(wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"

Telegram Desktop

yaourt -S telegram-desktop-bin

PHP

sudo pacman -S php php-fpm php-apcu php-gd php-imap php-intl php-mcrypt php-memcached php-pgsql php-sqlite php-cgi xdebug

Nginx

sudo pacman -S nginx

MariaDB

sudo pacman -S mariadb
sudo mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql

sudo pacman -S phpmyadmin

Redis, Postgresql, SQLite

sudo pacman -S redis postgresql sqlite
sudo -u postgres initdb --locale $LANG -E UTF8 -D '/var/lib/postgres/data'

Memcached, Beanstalkd, DNSMasq, Composer

sudo pacman -S memcached
yaourt -S beanstalkd
sudo pacman -S dnsmasq
sudo pacman -S composer

Git config

git config --global color.branch auto
git config --global color.diff auto
git config --global color.status auto

git config --global user.name "KLC215"
git config --global user.email johndoe@example.com

Node.js

PHP-CS-Fixer

sudo wget http://get.sensiolabs.org/php-cs-fixer.phar -O /usr/local/bin/php-cs-fixer
sudo chmod a+x /usr/local/bin/php-cs-fixer

PHP config

sudo sed -i "s/error_reporting = .*/error_reporting = E_ALL/" /etc/php/php.ini
sudo sed -i "s/display_errors = .*/display_errors = On/" /etc/php/php.ini
sudo sed -i "s/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/" /etc/php/php.ini
sudo sed -i "s/memory_limit = .*/memory_limit = 512M/" /etc/php/php.ini
sudo sed -i "s/upload_max_filesize = .*/upload_max_filesize = 100M/" /etc/php/php.ini
sudo sed -i "s/post_max_size = .*/post_max_size = 100M/" /etc/php/php.ini
sudo sed -i "s/;date.timezone.*/date.timezone = Asia/Hong_Kong/" /etc/php/php.ini
sudo sed -i "s/short_open_tag = .*/short_open_tag = On/" /etc/php/php.ini

sudo sed -i "s/;extension=memcached.so/extension=memcached.so/" /etc/php/conf.d/memcached.ini
sudo sed -i "s/;extension=bcmath.so/extension=bcmath.so/" /etc/php/php.ini
sudo sed -i "s/;extension=bz2.so/extension=bz2.so/" /etc/php/php.ini
sudo sed -i "s/;extension=curl.so/extension=curl.so/" /etc/php/php.ini
sudo sed -i "s/;extension=exif.so/extension=exif.so/" /etc/php/php.ini
sudo sed -i "s/;extension=ftp.so/extension=ftp.so/" /etc/php/php.ini
sudo sed -i "s/;extension=gd.so/extension=gd.so/" /etc/php/php.ini
sudo sed -i "s/;extension=iconv.so/extension=iconv.so/" /etc/php/php.ini
sudo sed -i "s/;extension=imap.so/extension=imap.so/" /etc/php/php.ini
sudo sed -i "s/;extension=intl.so/extension=intl.so/" /etc/php/php.ini
sudo sed -i "s/;extension=mcrypt.so/extension=mcrypt.so/" /etc/php/php.ini
sudo sed -i "s/;extension=mysqli.so/extension=mysqli.so/" /etc/php/php.ini
sudo sed -i "s/;zend_extension=opcache.so/zend_extension=opcache.so/" /etc/php/php.ini
sudo sed -i "s/;extension=sqlite3.so/extension=sqlite3.so/" /etc/php/php.ini
sudo sed -i "s/;extension=pdo_mysql.so/extension=pdo_mysql.so/" /etc/php/php.ini
sudo sed -i "s/;extension=pdo_pgsql.so/extension=pdo_pgsql.so/" /etc/php/php.ini
sudo sed -i "s/;extension=pdo_sqlite.so/extension=pdo_sqlite.so/" /etc/php/php.ini
sudo sed -i "s/;extension=soap.so/extension=soap.so/" /etc/php/php.ini
sudo sed -i "s/;extension=sockets.so/extension=sockets.so/" /etc/php/php.ini
sudo sed -i "s/;extension=zip.so/extension=zip.so/" /etc/php/php.ini

sudo sed -i "s/user = .*/user = $USER/" /etc/php/php-fpm.d/www.conf
sudo sed -i "s/group = .*/group = users/" /etc/php/php-fpm.d/www.conf

sudo sed -i "s/listen.owner = .*/listen.owner = $USER/" /etc/php/php-fpm.d/www.conf
sudo sed -i "s/listen.group = .*/listen.group = users/" /etc/php/php-fpm.d/www.conf

Local SSL config

sudo mkdir -p /etc/ssl/webDev

sudo openssl req -nodes -newkey rsa:2048 -keyout /etc/ssl/webDev/webdev.local.key -out /etc/ssl/webDev/webdev.local.csr -subj "/CN=*.local, *.lh"
sudo openssl x509 -req -days 3650 \
                   -in /etc/ssl/webDev/webdev.local.csr  \
                   -signkey /etc/ssl/webDev/webdev.local.key  \
                   -out /etc/ssl/webDev/webdev.local.crt

Nginx config

sudo curl -L https://gist.github.com/rhwilr/ce7338a972ef0c5585ce0c01e54bb13b/raw/nginx.conf -o /etc/nginx/nginx.conf

sudo sed -i "s/user johndoe users;/user $USER users;/" /etc/nginx/nginx.conf
sudo sed -i "s/\/home\/johndoe/\/home\/$USER/" /etc/nginx/nginx.conf

mkdir -p ~/webDev/log

DNSMasq config

sudo sed -i "s/^#conf-dir=\/etc\/dnsmasq.d\/,\*\.conf/conf-dir=\/etc\/dnsmasq.d\/,\*\.conf/" /etc/dnsmasq.conf
sudo mkdir /etc/dnsmasq.d/
echo address=/.local/127.0.0.1 | sudo tee /etc/dnsmasq.d/webDev.conf
echo address=/.lh/127.0.0.1 | sudo tee -a /etc/dnsmasq.d/webDev.conf
echo nameserver 127.0.0.1 | sudo tee /etc/resolv.conf.head

Enable services

sudo resolvconf -u
sudo systemctl enable nginx.service php-fpm.service dnsmasq.service mysqld.service redis.service postgresql.service memcached.service beanstalkd
sudo systemctl start nginx.service php-fpm.service dnsmasq.service mysqld.service redis.service postgresql.service memcached.service beanstalkd

sudo mysql_secure_installation

Testing

mkdir -p ~/webDev/me/public
cat > ~/webDev/me/public/index.php << EOL
<?php
phpinfo();
EOL

Tools

yaourt -S phpstorm visual-studio-code smartgit

Increase inotify

echo fs.inotify.max_user_watches = 524288 | sudo tee /etc/sysctl.d/99-sysctl.conf

Xdebug

sudo sed -i "s/;zend_extension=xdebug.so/zend_extension=xdebug.so/" /etc/php/conf.d/xdebug.ini
sudo sed -i "s/;xdebug.remote_enable=on/xdebug.remote_enable=on/" /etc/php/conf.d/xdebug.ini
sudo sed -i "s/;xdebug.remote_host=127.0.0.1/xdebug.remote_host=127.0.0.1/" /etc/php/conf.d/xdebug.ini
sudo sed -i "s/;xdebug.remote_port=9000/xdebug.remote_port=9000/" /etc/php/conf.d/xdebug.ini
sudo sed -i "s/;xdebug.remote_handler=dbgp/xdebug.remote_handler=dbgp/" /etc/php/conf.d/xdebug.ini
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment