Skip to content

Commit 38bc44e

Browse files
committed
modified: README.md
modified: lsws1clk.sh
1 parent 4b870b8 commit 38bc44e

File tree

2 files changed

+47
-35
lines changed

2 files changed

+47
-35
lines changed

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ See below for additional options and usage examples.
3434
| `-A` |`--adminpassword [PASSWORD]`| To set the WebAdmin password for LiteSpeed instead of using a random one.|
3535
| |`--adminport [PORTNUMBER]`| To set the WebAdmin console port number instead of 7080.|
3636
| `-E` |`--email [EMAIL]`| To set the administrator email.|
37-
| |`--lsphp [VERSION]` | To set the LSPHP version, such as 82. We currently support versions '71 72 73 74 80 81 82 83'.|
38-
| |`--mariadbver [VERSION]` | To set MariaDB version, such as 10.9. We currently support versions '10.2 10.3 ...10.11'.|
37+
| |`--lsphp [VERSION]` | To set the LSPHP version, such as 83. We currently support versions '74 80 81 82 83'.|
38+
| |`--mariadbver [VERSION]` | To set MariaDB version, such as 11.4. We currently support versions '10.6 10.11 11.4 11.6'.|
3939
| `-W` |`--wordpress`| To install WordPress. You will still need to complete the WordPress setup by browser|
4040
| | `--wordpressplus [SITEDOMAIN]`| To install, set up, and configure WordPress, also LSCache will be enabled|
4141
| | `--wordpresspath [WP_PATH]`| To specify a location for the new WordPress installation or use for an existing WordPress.|
@@ -73,7 +73,7 @@ See below for additional options and usage examples.
7373
| `./lsws1clk.sh` |To install LiteSpeed with a random WebAdmin password.|
7474
| `./lsws1clk.sh --lsphp 83 ` |To install LiteSpeed with lsphp83.|
7575
| `./lsws1clk.sh -A 123456 -e a@cc.com` |To install LiteSpeed with WebAdmin password "123456" and email a@cc.com.|
76-
| `./lsws1clk.sh -R 123456 -W ` |To install LiteSpeed with WordPress and MySQL root password "123456".|
76+
| `./lsws1clk.sh -R 123456 -W ` |To install LiteSpeed with WordPress and MariaDB root password "123456".|
7777
| `./lsws1clk.sh --wordpressplus a.com` |To install LiteSpeed with a fully configured WordPress installation at "a.com".|
7878

7979
## FAQ

lsws1clk.sh

+44-32
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ ROOTPASSWORD=
4848
USERPASSWORD=
4949
WPPASSWORD=
5050
LSPHPVERLIST=(74 80 81 82 83 84)
51-
MARIADBVERLIST=(10.11 11.4 11.6)
52-
OLD_SYS_MARIADBVERLIST=(10.2 10.3 10.4 10.5)
51+
MARIADBVERLIST=(10.5 10.6 10.11 11.4 11.6)
5352
LSPHPVER=83
5453
MARIADBVER=11.4
5554
#MYSQLVER=8.0
@@ -70,6 +69,8 @@ EPACE=' '
7069
FPACE=' '
7170
APT='apt-get -qq'
7271
YUM='yum -q'
72+
mysqladmin='mysqladmin'
73+
mysql='mysql'
7374
MYGITHUBURL=https://raw.githubusercontent.com/litespeedtech/lsws1clk/master/lsws1clk.sh
7475

7576
function echoY
@@ -211,13 +212,13 @@ function restart_lsws
211212
function usage
212213
{
213214
echo -e "\033[1mOPTIONS\033[0m"
214-
echoNW " -L, license" "${EPACE}To use specified LSWS serial number."
215+
echoNW " -L, license" "${EPACE} To use specified LSWS serial number."
215216
echoW " --adminuser [USERNAME]" "${EPACE} To set the WebAdmin username for LiteSpeed instead of admin."
216217
echoNW " -A, --adminpassword [PASSWORD]" "${EPACE}To set the WebAdmin password for LiteSpeed instead of using a random one."
217218
echoW " --adminport [PORTNUMBER]" "${EPACE} To set the WebAdmin console port number instead of 7080."
218219
echoNW " -E, --email [EMAIL] " "${EPACE} To set the administrator email."
219-
echoW " --lsphp [VERSION] " "To set the LSPHP version, such as 82. We currently support versions '${LSPHPVERLIST[@]}'."
220-
echoW " --mariadbver [VERSION] " "To set MariaDB version, such as 10.6. We currently support versions '${MARIADBVERLIST[@]}'."
220+
echoW " --lsphp [VERSION] " "To set the LSPHP version, such as 83. We currently support versions '${LSPHPVERLIST[@]}'."
221+
echoW " --mariadbver [VERSION] " "To set MariaDB version, such as 11.4. We currently support versions '${MARIADBVERLIST[@]}'."
221222
echoNW " -W, --wordpress " "${EPACE} To install WordPress. You will still need to complete the WordPress setup by browser"
222223
echoW " --wordpressplus [SITEDOMAIN] " "To install, setup, and configure WordPress, also LSCache will be enabled"
223224
echoW " --wordpresspath [WP_PATH] " "To specify a location for the new WordPress installation or an existing WordPress."
@@ -253,7 +254,7 @@ function usage
253254
echoW "./lsws1clk.sh " "To install LiteSpeed with a random WebAdmin password."
254255
echoW "./lsws1clk.sh --lsphp 83 " "To install LiteSpeed with lsphp83."
255256
echoW "./lsws1clk.sh -A 123456 -e a@cc.com " "To install LiteSpeed with WebAdmin password \"123456\" and email a@cc.com."
256-
echoW "./lsws1clk.sh -R 123456 -W " "To install LiteSpeed with WordPress and MySQL root password \"123456\"."
257+
echoW "./lsws1clk.sh -R 123456 -W " "To install LiteSpeed with WordPress and MariaDB root password \"123456\"."
257258
echoW "./lsws1clk.sh --wordpressplus a.com " "To install LiteSpeed with a fully configured WordPress installation at \"a.com\"."
258259
echo
259260
exit 0
@@ -786,7 +787,7 @@ function main_gen_password
786787
if [ "$INSTALLWORDPRESSPLUS" = "1" ] ; then
787788
read_password "$WPPASSWORD" "WordPress admin password"
788789
WPPASSWORD=$TEMPPASSWORD
789-
fi
790+
fi
790791
}
791792

792793
function main_lsws_password
@@ -800,33 +801,33 @@ function test_mysql_password
800801
CURROOTPASSWORD=$ROOTPASSWORD
801802
TESTPASSWORDERROR=0
802803

803-
mysqladmin -uroot -p$CURROOTPASSWORD password $CURROOTPASSWORD
804+
"${mysqladmin}" -uroot -p$CURROOTPASSWORD password $CURROOTPASSWORD
804805
if [ $? != 0 ] ; then
805806
#Sometimes, mysql will treat the password error and restart will fix it.
806807
service mysql restart
807808
if [ $? != 0 ] && [ "$OSNAME" = "centos" ] ; then
808809
service mysqld restart
809810
fi
810811

811-
mysqladmin -uroot -p$CURROOTPASSWORD password $CURROOTPASSWORD
812+
"${mysqladmin}" -uroot -p$CURROOTPASSWORD password $CURROOTPASSWORD
812813
if [ $? != 0 ] ; then
813814
printf '\033[31mPlease input the current root password:\033[0m'
814815
read answer
815-
mysqladmin -uroot -p$answer password $answer
816+
"${mysqladmin}" -uroot -p$answer password $answer
816817
if [ $? = 0 ] ; then
817818
CURROOTPASSWORD=$answer
818819
else
819820
echoR "root password is incorrect. 2 attempts remaining."
820821
printf '\033[31mPlease input the current root password:\033[0m'
821822
read answer
822-
mysqladmin -uroot -p$answer password $answer
823+
"${mysqladmin}" -uroot -p$answer password $answer
823824
if [ $? = 0 ] ; then
824825
CURROOTPASSWORD=$answer
825826
else
826827
echoR "root password is incorrect. 1 attempt remaining."
827828
printf '\033[31mPlease input the current root password:\033[0m'
828829
read answer
829-
mysqladmin -uroot -p$answer password $answer
830+
"${mysqladmin}" -uroot -p$answer password $answer
830831
if [ $? = 0 ] ; then
831832
CURROOTPASSWORD=$answer
832833
else
@@ -1131,9 +1132,19 @@ function install_postfix
11311132
fi
11321133
}
11331134

1135+
function compatible_mariadb_cmd
1136+
{
1137+
MA_TMPVER=$(echo $MARIADBVER | awk -F '.' '{print $1}')
1138+
if [ ${MA_TMPVER} -ge 11 ]; then
1139+
mysqladmin='mariadb-admin'
1140+
mysql='mariadb'
1141+
fi
1142+
}
1143+
11341144
function install_mariadb
11351145
{
11361146
echoG "Start Install MariaDB"
1147+
compatible_mariadb_cmd
11371148
if [ "$OSNAME" = 'centos' ] ; then
11381149
centos_install_mariadb
11391150
else
@@ -1144,15 +1155,15 @@ function install_mariadb
11441155
echoR "Please fix this error and try again. Aborting installation!"
11451156
exit 1
11461157
fi
1147-
1158+
11481159
echoB "${FPACE} - Set MariaDB root"
1149-
mysql -uroot -e "flush privileges;"
1150-
mysqladmin -uroot password $ROOTPASSWORD
1160+
"${mysql}" -uroot -e "flush privileges;"
1161+
"${mysqladmin}" -uroot password $ROOTPASSWORD
11511162
if [ $? = 0 ] ; then
11521163
CURROOTPASSWORD=$ROOTPASSWORD
11531164
else
11541165
#test it is the current password
1155-
mysqladmin -uroot -p$ROOTPASSWORD password $ROOTPASSWORD
1166+
"${mysqladmin}" -uroot -p$ROOTPASSWORD password $ROOTPASSWORD
11561167
if [ $? = 0 ] ; then
11571168
#echoG "MySQL root password is $ROOTPASSWORD"
11581169
CURROOTPASSWORD=$ROOTPASSWORD
@@ -1181,7 +1192,7 @@ function install_mariadb
11811192
echoG "OK, MySQL root password not changed."
11821193
ROOTPASSWORD=$CURROOTPASSWORD
11831194
else
1184-
mysqladmin -uroot -p$CURROOTPASSWORD password $ROOTPASSWORD
1195+
"${mysqladmin}" -uroot -p$CURROOTPASSWORD password $ROOTPASSWORD
11851196
if [ $? = 0 ] ; then
11861197
echoG "OK, MySQL root password changed to $ROOTPASSWORD."
11871198
else
@@ -1331,27 +1342,28 @@ function install_percona
13311342
function setup_mariadb_user
13321343
{
13331344
echoG "Start setup MariaDB"
1345+
compatible_mariadb_cmd
13341346
local ERROR=
13351347
#delete user if exists
1336-
mysql -uroot -p$ROOTPASSWORD -e "DELETE FROM mysql.user WHERE User = '$USERNAME@localhost';"
1348+
"${mysql}" -uroot -p$ROOTPASSWORD -e "DELETE FROM mysql.user WHERE User = '$USERNAME@localhost';"
13371349

1338-
echo `mysql -uroot -p$ROOTPASSWORD -e "SELECT user FROM mysql.user"` | grep "$USERNAME" >/dev/null
1350+
echo `"${mysql}" -uroot -p$ROOTPASSWORD -e "SELECT user FROM mysql.user"` | grep "$USERNAME" >/dev/null
13391351
if [ $? = 0 ] ; then
13401352
echoG "user $USERNAME exists in mysql.user"
13411353
else
1342-
mysql -uroot -p$ROOTPASSWORD -e "CREATE USER $USERNAME@localhost IDENTIFIED BY '$USERPASSWORD';"
1354+
"${mysql}" -uroot -p$ROOTPASSWORD -e "CREATE USER $USERNAME@localhost IDENTIFIED BY '$USERPASSWORD';"
13431355
if [ $? = 0 ] ; then
1344-
mysql -uroot -p$ROOTPASSWORD -e "GRANT ALL PRIVILEGES ON *.* TO '$USERNAME'@localhost IDENTIFIED BY '$USERPASSWORD';"
1356+
"${mysql}" -uroot -p$ROOTPASSWORD -e "GRANT ALL PRIVILEGES ON *.* TO '$USERNAME'@localhost IDENTIFIED BY '$USERPASSWORD';"
13451357
else
13461358
echoR "Failed to create MySQL user $USERNAME. This user may already exist. If it does not, another problem occured."
13471359
echoR "Please check this and update the wp-config.php file."
13481360
ERROR="Create user error"
13491361
fi
13501362
fi
13511363

1352-
mysql -uroot -p$ROOTPASSWORD -e "CREATE DATABASE IF NOT EXISTS $DATABASENAME;"
1364+
"${mysql}" -uroot -p$ROOTPASSWORD -e "CREATE DATABASE IF NOT EXISTS $DATABASENAME;"
13531365
if [ $? = 0 ] ; then
1354-
mysql -uroot -p$ROOTPASSWORD -e "GRANT ALL PRIVILEGES ON $DATABASENAME.* TO '$USERNAME'@localhost IDENTIFIED BY '$USERPASSWORD';"
1366+
"${mysql}" -uroot -p$ROOTPASSWORD -e "GRANT ALL PRIVILEGES ON $DATABASENAME.* TO '$USERNAME'@localhost IDENTIFIED BY '$USERPASSWORD';"
13551367
else
13561368
echoR "Failed to create database $DATABASENAME. It may already exist. If it does not, another problem occured."
13571369
echoR "Please check this and update the wp-config.php file."
@@ -1361,7 +1373,7 @@ function setup_mariadb_user
13611373
ERROR="$ERROR and create database error"
13621374
fi
13631375
fi
1364-
mysql -uroot -p$ROOTPASSWORD -e "flush privileges;"
1376+
"${mysql}" -uroot -p$ROOTPASSWORD -e "flush privileges;"
13651377

13661378
if [ "x$ERROR" = "x" ] ; then
13671379
echoG "Finished MySQL setup without error."
@@ -1377,25 +1389,25 @@ function setup_mysql_user
13771389
echoG "Start setup MySQL"
13781390
local ERROR=
13791391
#delete user if exists
1380-
mysql -uroot -p$ROOTPASSWORD -e "DELETE FROM mysql.user WHERE User = '$USERNAME@localhost';" 2>/dev/null
1392+
"${mysql}" -uroot -p$ROOTPASSWORD -e "DELETE FROM mysql.user WHERE User = '$USERNAME@localhost';" 2>/dev/null
13811393

1382-
echo `mysql -uroot -p$ROOTPASSWORD -e "SELECT user FROM mysql.user" 2>/dev/null` | grep "$USERNAME" >/dev/null
1394+
echo `"${mysql}" -uroot -p$ROOTPASSWORD -e "SELECT user FROM mysql.user" 2>/dev/null` | grep "$USERNAME" >/dev/null
13831395
if [ $? = 0 ] ; then
13841396
echoG "user $USERNAME exists in mysql.user"
13851397
else
1386-
mysql -uroot -p$ROOTPASSWORD -e "CREATE USER $USERNAME@localhost IDENTIFIED BY '$USERPASSWORD';" 2>/dev/null
1398+
"${mysql}" -uroot -p$ROOTPASSWORD -e "CREATE USER $USERNAME@localhost IDENTIFIED BY '$USERPASSWORD';" 2>/dev/null
13871399
if [ $? = 0 ] ; then
1388-
mysql -uroot -p$ROOTPASSWORD -e "GRANT ALL PRIVILEGES ON *.* TO '$USERNAME'@localhost;" 2>/dev/null
1400+
"${mysql}" -uroot -p$ROOTPASSWORD -e "GRANT ALL PRIVILEGES ON *.* TO '$USERNAME'@localhost;" 2>/dev/null
13891401
else
13901402
echoR "Failed to create MySQL user $USERNAME. This user may already exist. If it does not, another problem occured."
13911403
echoR "Please check this and update the wp-config.php file."
13921404
ERROR="Create user error"
13931405
fi
13941406
fi
13951407

1396-
mysql -uroot -p$ROOTPASSWORD -e "CREATE DATABASE IF NOT EXISTS $DATABASENAME;" 2>/dev/null
1408+
"${mysql}" -uroot -p$ROOTPASSWORD -e "CREATE DATABASE IF NOT EXISTS $DATABASENAME;" 2>/dev/null
13971409
if [ $? = 0 ] ; then
1398-
mysql -uroot -p$ROOTPASSWORD -e "GRANT ALL PRIVILEGES ON $DATABASENAME.* TO '$USERNAME'@localhost;" 2>/dev/null
1410+
"${mysql}" -uroot -p$ROOTPASSWORD -e "GRANT ALL PRIVILEGES ON $DATABASENAME.* TO '$USERNAME'@localhost;" 2>/dev/null
13991411
else
14001412
echoR "Failed to create database $DATABASENAME. It may already exist. If it does not, another problem occured."
14011413
echoR "Please check this and update the wp-config.php file."
@@ -1405,7 +1417,7 @@ function setup_mysql_user
14051417
ERROR="$ERROR and create database error"
14061418
fi
14071419
fi
1408-
mysql -uroot -p$ROOTPASSWORD -e "flush privileges;" 2>/dev/null
1420+
"${mysql}" -uroot -p$ROOTPASSWORD -e "flush privileges;" 2>/dev/null
14091421

14101422
if [ "x$ERROR" = "x" ] ; then
14111423
echoG "Finished MySQL setup without error."
@@ -1887,7 +1899,7 @@ function check_cur_status
18871899
LSWSINSTALLED=0
18881900
fi
18891901

1890-
which mysqladmin >/dev/null 2>&1
1902+
which ${mysqladmin} >/dev/null 2>&1
18911903
if [ $? = 0 ] ; then
18921904
MYSQLINSTALLED=1
18931905
else

0 commit comments

Comments
 (0)