wip: 2025-12-22T21:37:28+0000 (1766439448)

This commit is contained in:
Victor Westerlund 2025-12-22 21:37:28 +00:00
parent 168b2a2425
commit 338694f565

View file

@ -1,26 +1,12 @@
#!/bin/bash
install_packages() {
local PACKAGES=(
"jq"
"git"
"curl"
)
# Create a string with the package names separated by spaces
local package_list="${PACKAGES[*]}"
sudo apt update
sudo apt install -y $package_list
sudo apt install -y jq git curl tmux
}
install_mariadb() {
local PACKAGES=(
"mysql-client"
"mariadb-server"
)
sudo apt install $PACKAGES[*]
sudo apt install -y default-mysql-client mariadb-server
# Create a database user for the webserver
sudo mysql -u root -e "CREATE USER 'www-data'@'localhost' IDENTIFIED WITH unix_socket; GRANT ALL PRIVILEGES ON *.* TO 'www-data'@'localhost' WITH GRANT OPTION; FLUSH PRIVILEGES;"
@ -68,16 +54,8 @@ install_reflect() {
install_webserver() {
local WWW_PATH="/var/www"
local PATH_NGINX="/etc/nginx"
local PACKAGES=(
"nginx"
"composer"
)
#sudo apt install $PACKAGES[*]
# Create a string with the package names separated by spaces
local package_list="${PACKAGES[*]}"
sudo apt install -y $package_list
sudo apt install -y nginx composer
sudo mkdir $WWW_PATH/fw
sudo mkdir $WWW_PATH/libs
@ -89,18 +67,21 @@ install_webserver() {
# Download default configs
sudo curl -o $PATH_NGINX/snippets/vlw.se-ssl.conf https://git.vlw.se/config/nginx-dev/raw/branch/master/snippets/vlw.se-ssl.conf
sudo curl -o $PATH_NGINX/sites-available/44300.conf https://git.vlw.se/config/nginx-dev/raw/branch/master/sites-available/44300.conf
sudo curl -o $PATH_NGINX/sites-available/44301.conf https://git.vlw.se/config/nginx-dev/raw/branch/master/sites-available/44301.conf
sudo curl -o $PATH_NGINX/sites-available/44302.conf https://git.vlw.se/config/nginx-dev/raw/branch/master/sites-available/44302.conf
sudo curl -o $PATH_NGINX/snippets/fastcgi-php.conf https://git.vlw.se/config/nginx-dev/raw/branch/master/snippets/fastcgi-php.conf
sudo curl -o $PATH_NGINX/sites-available/8001.conf https://git.vlw.se/config/nginx-dev/raw/branch/master/sites-available/8001.conf
sudo curl -o $PATH_NGINX/sites-available/8002.conf https://git.vlw.se/config/nginx-dev/raw/branch/master/sites-available/8002.conf
sudo curl -o $PATH_NGINX/sites-available/8003.conf https://git.vlw.se/config/nginx-dev/raw/branch/master/sites-available/8003.conf
sudo rm /etc/nginx/sites-enabled/44300.conf
sudo rm /etc/nginx/sites-enabled/44301.conf
sudo rm /etc/nginx/sites-enabled/44302.conf
sudo ln -s /etc/nginx/sites-available/44300.conf /etc/nginx/sites-enabled
sudo ln -s /etc/nginx/sites-available/44301.conf /etc/nginx/sites-enabled
sudo ln -s /etc/nginx/sites-available/44302.conf /etc/nginx/sites-enabled
sudo rm /etc/nginx/sites-enabled/8001.conf
sudo rm /etc/nginx/sites-enabled/8002.conf
sudo rm /etc/nginx/sites-enabled/8003.conf
sudo ln -s /etc/nginx/sites-available/8001.conf /etc/nginx/sites-enabled
sudo ln -s /etc/nginx/sites-available/8002.conf /etc/nginx/sites-enabled
sudo ln -s /etc/nginx/sites-available/8003.conf /etc/nginx/sites-enabled
sudo chown $(whoami):www-data -R $WWW_PATH
sudo systemctl restart nginx
}
install_pma() {
@ -115,15 +96,6 @@ install_pma() {
install_php_fpm() {
local PHP_VERSION="8.4"
local PHP_INI_PATH="/etc/php/$PHP_VERSION/fpm/php.ini"
local PACKAGES=(
"lsb-release"
"ca-certificates"
"php$PHP_VERSION-fpm"
"php$PHP_VERSION-mysql"
"php$PHP_VERSION-xdebug"
"php$PHP_VERSION-mbstring"
)
# https://packages.sury.org/php/README.txt
sudo curl -sSLo /tmp/debsuryorg-archive-keyring.deb https://packages.sury.org/debsuryorg-archive-keyring.deb
@ -132,7 +104,7 @@ install_php_fpm() {
# Install packages
sudo apt update
sudo apt install $PACKAGES[*]
sudo apt -y install lsb-release ca-certificates php$PHP_VERSION-fpm php$PHP_VERSION-mysql php$PHP_VERSION-xdebug php$PHP_VERSION-mbstring php$PHP_VERSION-intl
# Make a backup of the php.ini file
sudo cp -p "$PHP_INI_PATH" "$PHP_INI_PATH~"
@ -154,11 +126,11 @@ install_code_server() {
done
}
#install_packages
#install_php_fpm
#install_webserver
#install_vegvisir
#install_reflect
#install_pma
#install_mariadb
#install_code_server
install_packages
install_php_fpm
install_webserver
install_vegvisir
install_reflect
install_pma
install_mariadb
install_code_server