Although we have dockers and everything to make our developing work easier and faster, Nothing beats having eveything setup in your own local environment
Note:- This setup is just my own preference.
echo 'options snd-intel-dspcfg dsp_driver=1' | sudo tee -a /etc/modprobe.d/alsa-legacy.conf > /dev/null
sudo EDITOR=/usr/bin/nano visudo
outside ALL=(ALL) NOPASSWD: ALL
Copy expisting id_rsa and public ket to ~/.ssh
After completing the task above, you can use the scripts to setup your ubuntu. It is recommended to only use these scripts for fresh install. This will install and configure followings for you:
-
mysql-client
-
oh-my-zsh and set zsh as default shell, along with some nice plugins and themes
-
docker with docker compose v2
-
ruby version 3 with rbenv. Nokogiri and HTTParty gems are preinstalled (They are used to install nvm and docker)
-
nvm with latest node installed
-
Add all of the pre required softwares (defined in basic software installaion) and fonts to work with powerlevel10k theme.
-
zsh history completion
-
create docker network by default named pagevamp
-
create port proxy to redirect all request from
- 127.0.0.2:80 -> 127.0.0.1:81
- 127.0.0.2:443 -> 127.0.0.2:444
Reason for this is to be able to use nginx from host machine with port 80 and from docker in port 81/444
-
Add www-data to your user group so that nginx can access your home folder
-
sudo apt install git-core
-
git clone [email protected]:priosshrsth/ubuntu-setup-helper.git cd ubuntu-setup-helper
-
./setup.sh
-
(Note:- Do not install phpstorm, RubyMine and Node from snap package. Use official website to download and install them)
sudo apt update
sudo apt install --no-install-recommends google-perftools sudo apt install zsh vlc gimp gpart curl libfuse2 nginx \ gstreamer1.0-libav zlib1g-dev build-essential libssl-dev libreadline-dev \ libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev \ libcurl4-openssl-dev software-properties-common libffi-dev \ fonts-powerline mysql-client libmysqlclient-dev \ fonts-font-awesome exa python3-venv python3-pip
-
Setup These Shortcuts to make your life easier
-
Win + E => Open File Manager
nautilus --new-window
-
Win + D => Toggle Desktop
-
-
- For current user
chsh -s $(which zsh)
- For root user
sudo chsh -s $(which zsh)
-
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" git clone https://github.com/romkatv/powerlevel10k.git $ZSH_CUSTOM/themes/powerlevel10k git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
ZSH_THEME="powerlevel10k/powerlevel10k"
-
Configure powerlevel theme
p10k configure
-
git config --global color.ui true git config --global user.name "name" git config --global user.email "email" ssh-keygen -t ed25519 -C "email"
The next step is to take the newly generated SSH key and add it to your Github account. You want to copy and paste the output of the following command and paste it here.
cat ~/.ssh/id_rsa.pub
Once you've done this, you can check and see if it worked:
ssh -T [email protected]
You should get a message like this:
Hi priosshrsth! You've successfully authenticated, but GitHub does not provide shell access.
-
sudo iptables -t nat -A OUTPUT -o lo -d 127.0.0.2 -p tcp --dport 80 -j DNAT --to-destination 127.0.0.1:81 sudo iptables -t nat -A OUTPUT -o lo -d 127.0.0.2 -p tcp --dport 443 -j DNAT --to-destination 127.0.0.1:444
-
gedit ~/.profile
Then, Put these lines at the end:
sudo iptables -t nat -A OUTPUT -o lo -d 127.0.0.2 -p tcp --dport 80 -j DNAT --to-destination 127.0.0.1:81 sudo iptables -t nat -A OUTPUT -o lo -d 127.0.0.2 -p tcp --dport 443 -j DNAT --to-destination 127.0.0.1:444
Since, iptables requires sudo, we need to add it to sudoers to stop password prompt
sudo EDITOR=/usr/bin/nano visudo
And then, add this line at the end
[username] ALL=NOPASSWD: /usr/sbin/iptables
Please remember to leave empty line at the end of crontab file
Run these commands
chmod 700 ~/.ssh
chmod 600 ~/.ssh/*
ssh-add
https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/asdf
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.12.0
Goto: https://docs.docker.com/engine/install/ubuntu/
-
sudo usermod -aG docker $USER newgrp docker
-
docker network create --gateway 172.18.0.1 --subnet 172.18.0.0/24 pagevamp
edit ~/.docker/config.json
file. Add following code assuming 192..168.1.69 is your local ip
"proxies": { "default": { "noProxy": "192.168.1.69,127.0.0.0/8" } }
We have already installed nginx with our first apt install command.
-
sudo gpasswd -a www-data $USER sudo nginx -s reload
If above commmand fails, then run
sudo systemctl restart nginx
-
-
Add to the /etc/nginx/mime.types “image/webp webp”
-
Add to the main nginx.conf
map $http_accept $webp_suffix { default “”; “~*webp” “.webp”; }
And in the server block
location ~* ^/wp-content/.+\.(png|jpg)$ { add_header Vary Accept; try_files $uri$webp_suffix $uri =404; }
-
Edit /etc/mysql/my.cnf
and include these lines
[client]
host=172.18.0.15
user=root
password=root
If you fail to get the path
for my.cnf
, then use following command:
mysql --help | grep "Default options" -A 1
-
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - sudo apt-get update # Install the latest version of PostgreSQL. # If you want a specific version, use 'postgresql-12' or similar instead of 'postgresql': sudo apt-get -y install libpq-dev postgresql-client
-
export PGHOST="postgres"
sudo apt install php php-fpm php-cli php-mysql php-zip php-xml \
php-mbstring php-curl php-intl php-mongodb php-bcmath php-gd \
php-sqlite3
-
Install
Desktop Folder
App to set notes, images and folders in your desktop -
Also Install LocalTunnel instead of ngrok https://localtunnel.github.io/www/