Ubuntu-Nginx lightweight server environment setup Please review the following Bash script that uses to establish a "lightweight" Ubuntu-Nginx server environment mainly aimed to run small WordPress sites (about 5 plugins, about 25 webpages, about 25 images) on a cloud hosting platform.

The BASHRC heredocument sets aliases for personal scripts I already have and might use me later on.

apt-get update -y &amp;&amp; apt-get upgrade -y &amp;&amp; add-apt-repository ppa:certbot/certbot -y
ufw enable &amp;&amp; ufw allow 22/tcp 80/tcp 443/tcp 9000/tcp &amp;&amp; ufw allow 53/upd 
apt-get install zip unzip tree unattended-upgrades sshguard postfix nginx python-certbot-nginx mysql-server php-fpm php-mysql php-mbstring php-mcrypt -y

sed -i "s/# gzip_/gzip_/g" /etc/nginx/nginx.conf
sed -i "s/max_size = .M/max_size = 200M/g" /etc/php/*/fpm/php.ini
sed -i "s/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g" /etc/php/*/fpm/php.ini
/etc/init.d/php*-fpm restart &amp;&amp; systemctl restart nginx.service

cat &lt;&lt;-"BASHRC" &gt;&gt; /etc/bash.bashrc
    alias rss="/etc/init.d/php*-fpm restart &amp;&amp; systemctl restart nginx.service"
    alias brc="nano /etc/bash.bashrc"
    alias www="cd /var/www/html"
    alias pma="tmux new-session -d 'bash ~/scripts/pma.sh"
    alias imb="bash ~/scripts/imb.sh"
BASHRC
source /etc/bash.bashrc
Good


Tying together related commands with &amp;&amp; is a good error-avoidance strategy.


Trouble


The code is not re-entrant because the aliases will keep getting appended every time.  This is bad because you can only run or "enter" the code once safely.  You could touch file if the aliases are added and use that as a flag.  I would create the aliases in file and add a sourceing line to bashrc.  If you add the source line before creating the aliases file the aliases file could serve as your flag file for whether to add that line or not.
Running source on anything that doesn't have some side effect at the end of your script is pointless.  The source is causing the aliases you added to get read into the current shell.  But since you're at the end of your script there's no command that will use the aliases so it was a waste of effort to read them in.  Maybe you intend to do more with these later in the script, but it seems they are intended for the interactive user.  So sourceing the new aliases in an interactive shell would make them available to the interactive user sooner than logging out and logging back in would.
Some comments might save you from rethinking what you did someday.


Maybe trouble


Did you leave out a single quote in the pma alias?
Can you have more than one version of php-fpm installed?  If so your * in the command will expand in a weird way.  Maybe you can put the version you expect in a variable or use packaging commands to the find the version that is installed.
No sanity checking.  It might be good to error out if the files you are looking for turn out to not be around.
I hope you're storing your code in git somewhere.  The lack of a github link makes me wonder about this.