Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Install the LAMP stack
- #!/bin/bash
- if [ "$EUID" -ne 0 ]
- then
- echo 'Please run with sudo or as root.'
- exit 1
- fi
- # Install Apache, PHP, and PHP Modules
- echo "Installing LAMP"
- yum -q install -y httpd php php-mysql
- # Start and enable the web server
- echo "Starting Services"
- systemctl start httpd
- systemctl enable httpd
- # Install MariaDB
- echo "Installing MariaDB"
- yum -q install -y mariadb-server
- # Start and enable MariaDB
- echo "Starting MariaDB"
- systemctl start mariadb
- systemctl enable mariadb
- # Create a wordpress database
- echo "Creating a wordpress database"
- mysqladmin create wordpress
- # Create a user for the wordpress database
- echo "Creating a user for wordpress DB"
- mysql -e "GRANT ALL on wordpress.* to wordpress@localhost identified by 'wordpress123';"
- mysql -e "FLUSH PRIVILEGES;"
- # Remove the test DB privileges.
- echo "Removing test DB privs"
- mysql -e "DELETE FROM mysql.db where db='test' or db='test\\_%'"
- # Drop the test DB
- echo "Dropping test DB"
- mysqladmin drop -f test
- # Remove anonymous DB users.
- echo "Remove anonymous DB users"
- mysql -e "delete from mysql.user where user='';"
- # Remove remote root DB account access.
- echo "Remove remote root db account access"
- mysql -e "delete from mysql.user where user='root' and host not in ('localhost', '127.0.0.1', '::1');"
- # Set a root DB password
- echo "Set a root db password"
- mysql -e "update mysql.user set password=password('root123') where user='root';"
- # Flush the privileges
- echo "Flush privs"
- mysql -e "flush privileges;"
- # Download and extract WordPress
- echo "Download and extract Wordpress"
- TMP_DIR=$(mktemp -d)
- cd $TMP_DIR
- curl -sOL https://wordpress.org/latest.tar.gz
- tar zxf latest.tar.gz
- mv wordpress/* /var/www/html
- # Clean up
- echo "Clean up"
- cd /
- rm -rf $TMP_DIR
- # Install the wp-cli tool
- echo "Install wp-cli tool"
- curl -sOL https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
- chmod +x wp-cli.phar
- mv wp-cli.phar /usr/local/bin/wp
- chmod 755 /usr/local/bin/wp
- # Configure Wordpress
- echo "Configure Wordpress"
- cd /var/www/html
- /usr/local/bin/wp core config --dbname=wordpress --dbuser=wordpress --dbpass=wordpress123
- # Install wordpress
- echo "Install wordpress"
- /usr/local/bin/wp core install --url=http://localhost \
- --title="Blog" --admin_user="admin" --admin_password="admin" \
- --admin_email="root@localhost.localdomain"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement