Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- set -o errexit
- set -o nounset
- sudo bash
- # set time GMT +7
- ln -fs /usr/share/zoneinfo/Asia/Kuala_Lumpur /etc/localtime
- #change hostname
- cat >> /etc/hostname << EOF
- SMART MEDICINE FINDER
- EOF
- sudo bash
- # update
- apt-get update -y
- # install apache
- apt-get install apache2 apache2-doc apache2-utils -y
- apt-get install libapache2-mod-php5 php5 php-pear php5-xcache -y
- apt-get install php5-mysql -y
- apt-get install mysql-server mysql-client
- # Function
- usage(){
- cat << _EOF_
- Usage: ${0} "ROOT PASSWORD"
- with "ROOT PASSWORD" the desired password for the database root user.
- Use quotes if your password contains spaces or other special characters.
- _EOF_
- }
- # Predicate
- is_mysql_root_password_set(){
- ! mysqladmin --user=root status > /dev/null 2>&1
- }
- is_mysql_command_available(){
- which mysql > /dev/null 2>&1
- }
- if [ "$#" -ne "1" ]; then
- echo "Expected 1 argument, got $#" >&2
- usage
- exit 2
- fi
- #}}}
- #{{{ Variables
- db_root_password="${1}"
- #}}}
- # Script proper
- if ! is_mysql_command_available; then
- echo "The MySQL/MariaDB client mysql(1) is not installed."
- exit 1
- fi
- if is_mysql_root_password_set; then
- echo "Database root password already set"
- exit 0
- fi
- mysql --user=root <<_EOF_
- UPDATE mysql.user SET Password=PASSWORD('rootraspberry') WHERE User='root';
- DELETE FROM mysql.user WHERE User='';
- DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');
- DROP DATABASE IF EXISTS test;
- DELETE FROM mysql.db WHERE Db='test' OR Db='test\\_%';
- FLUSH PRIVILEGES;
- _EOF_
- #create php
- cat >> index.php << EOF
- index.php.d
- EOF
- #install samba
- apt-get install samba samba-common-bin -y
- apt install samba samba-common-bin -y
- echo "#======================= Global Settings =======================" > /etc/samba/smb.conf
- echo "[global]" >> /etc/samba/smb.conf
- echo "workgroup = WORKGROUP" >> /etc/samba/smb.conf
- echo "wins support = yes" >> /etc/samba/smb.conf
- cat >> /etc/samba/smb.conf << EOF
- [MyPiServer]
- comment = Pi Server Folder
- path = /var/www/html
- browseable = yes
- writeable = yes
- only guest = no
- create mask = 0777
- directory mask = 0777
- public = no
- read only = no
- force user = root
- [pihome]
- comment= Pi
- Home path=/home/pi
- browseable=Yes
- writeable=Yes
- only guest=no
- create mask=0777
- directory mask=0777
- public=no
- EOF
- smbpasswd -a pi
- #install remote
- apt-get install xrdp
- apt-get update
Add Comment
Please, Sign In to add comment