My Initial Setup stackscript

Avatar forum:jahid 1 year ago

Just finished writing my startup StackScript in Bash. It uses expect to automate some tasks like system upgrade (to bypass 'keep existing configuration file' prompt), mysqlsecureinstallation, and thus the whole process can be unattended.

It can do the following:

1. update (only package list) or upgrade (full upgrade) system

2.1. set hostname

2.2. add host entry with hostname to address

3. set up colorful bash prompt

4. set up a standard user with sudo privilege using a user defined login shell

5.1. set up SSH public key for a specified user

5.2. disable password login for SSH

5.3. disable root login for SSH

5.4. restrict SSH access to only IPV4 or IPV6

6. set up some common packages (git, wget, tar, gzip, lzip, bc, inxi, build-essential)

7. set up fail2ban

8.1 set up ufw

8.2 ufw: allow ftp, ssh, http, https and mail server ports

8.3 ufw: deny all incoming

8.4 ufw: allow all outgoing

9. set up sendmail

10.1 set up apache2

10.2 apache2 tuning for low memory

11.1 set up mysql

11.2 mysql tuning for security

11.3 mysql tuning for low memory

The logs are saved in /var/cache/ file

1 Reply

Sounds pretty neat. Well done.


Please enter an answer

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct