| Server IP : 104.129.129.72 / Your IP : 216.73.216.229 Web Server : LiteSpeed System : Linux 123answers 5.15.0-143-generic #153-Ubuntu SMP Fri Jun 13 19:10:45 UTC 2025 x86_64 User : answe8064 ( 1002) PHP Version : 8.2.28 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /opt/installer/services/ |
Upload File : |
#!/bin/bash
if [ -f "include/startup.sh" ]; then
. include/startup.sh
elif [ -f "../include/startup.sh" ]; then
. ../include/startup.sh
fi
checkTagExist ubuntu-updateos.success
echo "Create temp swap for composer processes" | log
#increase vm swappiness to allow swap to dominate process
sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
sleep 5
echo "Installing mysql from apt" | log
export DEBIAN_FRONTEND="noninteractive"
debconf-set-selections <<< "mysql-server-8.0 mysql-server/root_password password ${ADMINPASSWORD}"
debconf-set-selections <<< "mysql-server-8.0 mysql-server/root_password_again password ${ADMINPASSWORD}"
installPackage mysql-server
waitOrStop 0 "Failed apt install: mysql-server-8.0"
echo "Set ~/.my.cnf root password for quick cli work" | log
if [ ! -f /root/.my.cnf ]; then
cat << EOF > /root/.my.cnf
[client]
user=root
password="${ADMINPASSWORD}"
EOF
fi
chmod 600 /root/.my.cnf
echo "Running first setup process" | log
mysql_secure_installation --defaults-file=/root/.my.cnf -h localhost << EOF
n
n
y
y
y
y
EOF
# "Validate password plugin?" n
# "New password?" n
# "Remove anonymous users?" y
# "Disallow root login remotely?" y
# "Remove test database and access to it?" y
# "Reload privilege tables now?" y
echo "Set Password method for root" | log
mysql --defaults-file=/root/.my.cnf -h localhost <<EOF
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '${ADMINPASSWORD}';
EOF
echo "Setting some defaults to mysqld-installer.cnf" | log
if [ ! -f /etc/mysql/mysql.conf.d/mysqld-installer.cnf ]; then
cat << EOF > /etc/mysql/mysql.conf.d/mysqld-installer.cnf
[mysqld]
skip-name-resolve=1
max_allowed_packet=256M
EOF
fi
echo "Restarting mysql.service" | log
systemctl restart mysql.service
waitOrStop 0 "Restart mysql service failed"
echo "Adding descriptions" | log
descriptionAppend "mySQL Server Address: ${CWM_SERVERIP}"
descriptionAppend "mySQL Server Username: root"
descriptionAppend "mySQL Server Password: ${ADMINPASSWORD}"
descriptionAppend " "
descriptionAppend "mySQL Server config global files location: /etc/mysql/"
descriptionAppend "mySQL Server config user-specific file: ~/.my.cnf"
descriptionAppend " "
tag mysql-server-5.7.success
tag mysqld.success
tagScript success
exit 0