-
-
Save nboubakr/5048869 to your computer and use it in GitHub Desktop.
#!/bin/bash | |
# | |
# Install LAMP Server on Fedora | |
# | |
# Syntax: sudo ./LAMP-installer.sh | |
# | |
# Boubakr NOUR <n.boubakr@gmail.com> | |
# Distributed under the GPL version 3 license | |
boldRed='\e[1;31m' | |
boldGreen='\e[1;32m' | |
boldBlue='\e[1;34m' | |
reset='\e[0m' | |
isRoot() { | |
if [[ $EUID -ne 0 ]]; then | |
return 0 | |
else | |
return 1 | |
fi | |
} | |
checkInternet() { | |
wget -q --tries=10 --timeout=5 http://www.google.com -O /tmp/index.google &> /dev/null | |
if [ ! -s /tmp/index.google ];then | |
return 0 | |
else | |
return 1 | |
fi | |
} | |
clear | |
echo | |
echo -e $boldGreen"Install LAMP Server on Fedora..." $reset | |
if [[ checkInternet = 0 ]]; then | |
echo -e $boldYellow"[!] Please check you Internet Connection..." $reset | |
exit 1 | |
fi | |
if [[ ! isRoot ]]; then | |
echo | |
echo -e $boldRed"[!] This script must be run as root..." $reset 1>&2 | |
exit 1 | |
else | |
echo | |
echo -e $boldBlue"[!] Updating the system..." $reset | |
yum update -y | |
echo | |
echo -e $boldBlue"[!] Installing Apache Server..." $reset | |
yum groupinstall -y web-server | |
echo | |
echo -e $boldBlue"[!] Starting Apache HTTP Server..." $reset | |
systemctl start httpd.service | |
echo | |
read -p "Do you want to autostart Apache HTTP Server on boot ? (y/N) " answer | |
if [ "$answer" = 'y' ]; then | |
systemctl enable httpd.service | |
fi | |
echo | |
echo -e $boldBlue"[!] Enable Remote Connection to Apache HTTP Server..." $reset | |
echo "-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT" >> /etc/sysconfig/iptables | |
echo | |
echo -e $boldBlue"[!] Installing MySQL Database Server..." $reset | |
yum groupinstall -y mysql | |
echo | |
echo -e $boldBlue"[!] Starting MySQL Server..." $reset | |
systemctl start mysqld.service | |
echo | |
read -p "Do you want to autostart MySQL Server on boot ? (y/N) " answer | |
if [ "$answer" = 'y' ]; then | |
systemctl enable mysqld.service | |
fi | |
echo | |
echo -e $boldBlue"[!] MySQL Secure Installation..." $reset | |
# /usr/bin/mysql_secure_installation | |
echo | |
echo -e $boldBlue"[!] Enable Remote Connection to Apache HTTP Server..." $reset | |
echo "-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT" >> /etc/sysconfig/iptables | |
echo | |
echo -e $boldBlue"[!] Installing PHPMyAdmin..." $reset | |
yum install -y phpMyAdmin | |
echo | |
echo -e $boldGreen"All Done..." $reset | |
fi |
#!/bin/bash | |
# | |
# Simple script to control webServer | |
# | |
# Syntax: sudo ./webServer.sh [start|restart|stop] | |
# | |
# Boubakr NOUR <n.boubakr@gmail.com> | |
# Distributed under the GPL version 3 license | |
case "$1" in | |
"start") | |
echo "Starting Web Server" | |
systemctl start httpd.service | |
systemctl start mysqld.service | |
;; | |
"restart") | |
echo "Restarting Web Server" | |
systemctl restart httpd.service | |
systemctl restart mysqld.service | |
;; | |
"stop") | |
echo "Stopping Web Server" | |
systemctl stop httpd.service | |
systemctl stop mysqld.service | |
;; | |
* ) | |
echo "Usage: $0 [start|restart|stop]" | |
;; | |
esac |
Works with many change on jumplist action registering (code below).
Is there a way to have loggin screen once only instead of twice ?
[Desktop Entry]
Name=lamp
GenericName=lamp
X-GNOME-FullName=lamp
Comment=Open services of your LAMP server
Exec= sh /home/nlebrun/Documents/Sites/webServer.sh start
Icon=/usr/share/icons/ultra-flat-icon-theme/devices/scalable/gnome-dev-dvd.svg
Terminal=false
Type=Application
StartupNotify=true
Categories=Programing;Development;Electronics
Actions=Start;Stop;Restart;
X-Desktop-File-Install-Version=0.22
[Desktop Action Start]
Name=Start
Exec=sh /home/nlebrun/Documents/Sites/webServer.sh start
[Desktop Action Stop]
Name=Stop
Exec=sh /home/nlebrun/Documents/Sites/webServer.sh stop
[Desktop Action Restart]
Name=Restart
Exec=sh /home/nlebrun/Documents/Sites/webServer.sh restart
For login once only:
systemctl start httpd.service && start mariadb.service
or
systemctl start httpd.service && start mysqld.service
hi,
Can we use webServer.sh with a .desktop files to use as application shortcut with jumplist to launch start, stop and restart function.
Jumplist doesn't work on my lamp.desktop file but on click it launch apache and mariadb (on Korora 22)
lamp.desktop content
[Desktop Entry]
Name=lamp
GenericName=lamp
X-GNOME-FullName=lamp
Comment=Open services of your LAMP server
Exec= sh /home/nlebrun/Documents/Sites/webServer.sh start
Icon=/usr/share/icons/ultra-flat-icon-theme/devices/scalable/gnome-dev-dvd.svg
Terminal=false
Type=Application
StartupNotify=true
Categories=Programing;Development;Electronics
X-Ayatana-Desktop-Shortcuts=Start;Stop;Restart
[Start Shortcut Group]
Name=Start
Exec=sh /home/nlebrun/Documents/Sites/webServer.sh start
TargetEnvironment=Unity
[Stop Shortcut Group]
Name=Stop
Exec=sh /home/nlebrun/Documents/Sites/webServer.sh stop
TargetEnvironment=Unity
[Restart Shortcut Group]
Name=Restart
Exec=sh /home/nlebrun/Documents/Sites/webServer.sh restart
TargetEnvironment=Unity