From ab7c90e05b2c1c3fc9aeea132cb34ed1e6953126 Mon Sep 17 00:00:00 2001 From: Valentin Date: Fri, 23 Feb 2024 14:28:42 +0100 Subject: [PATCH] =?UTF-8?q?d=C3=A9but=20du=20script=20install?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 27 ++++++++++++++++++++++++++ install.sh | 42 +++++++++++++++++++++++++++++++++++++++++ utils/export-content.sh | 1 + utils/upgrade.sh | 1 + 4 files changed, 71 insertions(+) create mode 100644 install.sh create mode 100644 utils/export-content.sh create mode 100644 utils/upgrade.sh diff --git a/README.md b/README.md index c2cc832..473db88 100644 --- a/README.md +++ b/README.md @@ -2,3 +2,30 @@ Deployment [**D**ebian](https://www.debian.org/) (os) + [**C**addy](https://caddyserver.com/) (webserver) + [**D**irectus](https://directus.io/) (cms) + [**N**uxt](https://nuxt.com/) (front). +## Installation + +On a fresh install a root user + +1. Upgrade + +`apt update && apt upgrade` + +2. Install git + +`apt install git` + +3. Download and make the instal script executable + +`git clone https://figureslibres.io/gitea/valentin_le_moign/deployment-dcdn.git` + +`cd deployment-dcdn` + +`chmod u+x install.sh` + +4. Launch the script + +`bash install.sh` + +## Ref + +[Debian Web Server](https://figureslibres.io/gogs/bachir/debian-web-server) \ No newline at end of file diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..1c0adb0 --- /dev/null +++ b/install.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +echo "Deployment Debian + Caddy + Directus + Nuxt" + +if [ "$EUID" -ne 0 ]; then + echo "Please run as root" + exit +fi + +# +# USER +# + +echo "Create user" + +read -p "Enter username: " username + +if id "$username" &>/dev/null; then + echo "User '$username' already exists." + exit 1 +fi + +echo "Generate and store the password somewhere safe" +read -s -p "Enter password: " password +echo +sudo useradd -m "$username" +echo "$username:$password" | chpasswd + +usermod -aG sudo $username + +echo "User '$username' created with password successfully." + +# +# SSH +# + +echo "Setup SSH" + +touch /etc/ssh/sshd_config.d/custom.conf +echo "PermitRootLogin no" >> /etc/ssh/sshd_config.d/custom.conf +echo "PermitEmptyPasswords no" >> /etc/ssh/sshd_config.d/custom.conf +systemctl reload ssh \ No newline at end of file diff --git a/utils/export-content.sh b/utils/export-content.sh new file mode 100644 index 0000000..cc1f786 --- /dev/null +++ b/utils/export-content.sh @@ -0,0 +1 @@ +#!/bin/bash \ No newline at end of file diff --git a/utils/upgrade.sh b/utils/upgrade.sh new file mode 100644 index 0000000..cc1f786 --- /dev/null +++ b/utils/upgrade.sh @@ -0,0 +1 @@ +#!/bin/bash \ No newline at end of file