Quick script for running initial actions on new Digital Ocean droplets. Salt states are great, but this is very, very simple.
Runs through the following setup steps:
- Updating installed packages
- Timezone selection
- Root user configuration
- Standard user creation
- Swap file configuration (this is officially discouraged but included here for... legacy reasons?)
- MySQL configuration
- Pillow (Python image library) dependency installation
Designed for Ubuntu 20.04 on a 1GB RAM instance, but fairly portable. You can find a legacy version for Ubuntu 18.04 on the
Piping the contents of third-party URLs to
bash is, on the whole, extremely risky behaviour. It's also quite convenient. Please inspect the contents of the script to satisfy yourself that it's benign before attempting to run it. You can make BIG TROUBLE for yourself otherwise! If you're in any doubt, don't proceed. I'm just a guy on the Internet! For some extra peace of mind you may wish to download the script first, using
curl, before running it.
# bash <(curl -o - https://raw.githubusercontent.com/biggleszx/sysprep.sh/master/sysprep.sh)
If you want to use the legacy version for Ubuntu 18.04, it's this:
# bash <(curl -o - https://raw.githubusercontent.com/BigglesZX/sysprep.sh/ubuntu18/sysprep.sh)
SSH root access
When the script completes and your standard user is set up, you'll probably want to remove root's ability to log in over SSH.
Open the file
/etc/ssh/sshd_config and locate the line:
Change it to:
ssh service (be warned: this will probably disconnect you if you're currently connected via SSH):
# service ssh restart
The MIT License (MIT) Copyright (c) 2022 James Tiplady Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.