Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794
{"id":2552,"date":"2019-12-06T14:18:38","date_gmt":"2019-12-06T14:18:38","guid":{"rendered":"https:\/\/support.aklwebhost.com\/?post_type=manual_kb&p=2552"},"modified":"2019-12-06T19:00:54","modified_gmt":"2019-12-06T19:00:54","slug":"install-wordpress-with-apache-php-and-mysql-automated-startup-script","status":"publish","type":"manual_kb","link":"https:\/\/support.aklwebhost.com\/knowledgebase\/install-wordpress-with-apache-php-and-mysql-automated-startup-script\/","title":{"rendered":"Install WordPress with Apache, PHP and MySQL (Automated Startup Script)"},"content":{"rendered":"

You can copy and paste the following bash script into the startup script area of the\u00a0AKLWEB Host Control Panel<\/span><\/a><\/strong>.<\/p>\n

It will install all of necessary\u00a0packages to run WordPress<\/strong>, generate and import database credentials, and open the necessary firewall ports.<\/p>\n

#\/bin\/sh\r\ninstall_dir=\"\/var\/www\/html\"\r\n#Creating Random WP Database Credenitals\r\ndb_name=\"wp`date +%s`\"\r\ndb_user=$db_name\r\ndb_password=`date |md5sum |cut -c '1-12'`\r\nsleep 1\r\nmysqlrootpass=`date |md5sum |cut -c '1-12'`\r\nsleep 1\r\nftp_password=`date |md5sum |cut -c '1-12'`\r\n\r\n#### Install Packages for https and mysql\r\nyum -y install httpd httpd-devel\r\nyum -y install mysql mysql-server mysql-devel\r\nyum -y install lynx vsftpd\r\n##### Open firewall for http and SSL\r\niptables -F\r\niptables -A INPUT -i lo -j ACCEPT\r\niptables -A INPUT -p tcp -m tcp --dport 22 -j ACCEPT\r\niptables -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT\r\niptables -A INPUT -p tcp -m tcp --dport 443 -j ACCEPT\r\n\/etc\/init.d\/iptables save\r\n\/etc\/init.d\/iptables restart\r\n#### Start http\r\n\/etc\/init.d\/httpd start\r\nchkconfig httpd on\r\n\r\n#### Start mysql and set root password\r\n\/etc\/init.d\/mysqld start\r\nchkconfig mysqld on\r\n\r\n\/usr\/bin\/mysql -e \"USE mysql;\"\r\n\/usr\/bin\/mysql -e \"UPDATE user SET Password=PASSWORD($mysqlrootpass) WHERE user='root';\"\r\n\/usr\/bin\/mysql -e \"FLUSH PRIVILEGES;\"\r\ntouch \/root\/.my.cnf\r\nchmod 640 \/root\/.my.cnf\r\necho \"[client]\">\/root\/.my.cnf\r\necho \"user=root\">\/root\/.my.cnf\r\necho \"password=\"$mysqlrootpass>\/root\/.my.cnf\r\n####Install PHP\r\nyum -y install php php-common php-mysql php-gd php-mbstring php-mcrypt php-xml php-devel\r\n\r\nsed -i '0,\/AllowOverride\\ None\/! {0,\/AllowOverride\\ None\/ s\/AllowOverride\\ None\/AllowOverride\\ All\/}' \/etc\/httpd\/conf\/httpd.conf #Allow htaccess usage\r\n\r\n\/etc\/init.d\/httpd restart\r\n\r\n####Download and extract latest WordPress Package\r\nif test -f \/tmp\/latest.tar.gz\r\nthen\r\necho \"WP is already downloaded.\"\r\nelse\r\necho \"Downloading WordPress\"\r\ncd \/tmp\/ && wget \"http:\/\/wordpress.org\/latest.tar.gz\";\r\nfi\r\n\r\n\/bin\/tar -C $install_dir -zxf \/tmp\/latest.tar.gz --strip-components=1\r\nchown apache: $install_dir -R\r\n#### Set FTP Credentials\r\necho $ftp_password | passwd apache --stdin\r\n\/etc\/init.d\/vsftpd start\r\nchkconfig vsftpd on\r\n\r\n#### Create WP-config and set DB credentials\r\n\/bin\/mv $install_dir\/wp-config-sample.php $install_dir\/wp-config.php\r\n\r\n\/bin\/sed -i \"s\/database_name_here\/$db_name\/g\" $install_dir\/wp-config.php\r\n\/bin\/sed -i \"s\/username_here\/$db_user\/g\" $install_dir\/wp-config.php\r\n\/bin\/sed -i \"s\/password_here\/$db_password\/g\" $install_dir\/wp-config.php\r\n\r\ncat << EOF >> $install_dir\/wp-config.php\r\ndefine('FS_METHOD', 'ftpext');\r\ndefine('FTP_BASE', '$install_dir');\r\ndefine('FTP_USER', 'apache');\r\ndefine('FTP_PASS', '$ftp_password');\r\ndefine('FTP_HOST', '127.0.0.1');\r\ndefine('FTP_SSL', false);\r\nEOF\r\n\r\ncat << EOF >> $install_dir\/.htaccess\r\n# BEGIN WordPress\r\n<IfModule mod_rewrite.c>\r\nRewriteEngine On\r\nRewriteBase \/\r\nRewriteRule ^index.php$ \u2013 [L]\r\nRewriteCond %{REQUEST_FILENAME} !-f\r\nRewriteCond %{REQUEST_FILENAME} !-d\r\nRewriteRule . \/index.php [L]\r\n<\/IfModule>\r\n# END WordPress\r\nEOF\r\n\r\nchown apache: $install_dir -R\r\n\r\n##### Set WP Salts\r\ngrep -A50 'table_prefix' $install_dir\/wp-config.php > \/tmp\/wp-tmp-config\r\n\/bin\/sed -i '\/**#@\/,\/$p\/d' $install_dir\/wp-config.php\r\n\/usr\/bin\/lynx --dump -width 200 https:\/\/api.wordpress.org\/secret-key\/1.1\/salt\/ >> $install_dir\/wp-config.php\r\n\/bin\/cat \/tmp\/wp-tmp-config >> $install_dir\/wp-config.php && rm \/tmp\/wp-tmp-config -f\r\n\/usr\/bin\/mysql -u root -e \"CREATE DATABASE $db_name\"\r\n\/usr\/bin\/mysql -u root -e \"GRANT ALL PRIVILEGES ON $db_name.* to '\"$db_user\"'@'localhost' IDENTIFIED BY '\"$db_password\"';\"\r\n\r\n######Display generated passwords to log file.\r\necho \"Database Name: \" $db_name\r\necho \"Database User: \" $db_user\r\necho \"Database Password: \" $db_password\r\necho \"Mysql root password: \" $mysqlrootpass\r\necho \"FTP Password: \" $ftp_password\r\n<\/code><\/pre>\n

You will not need, but can retrieve the\u00a0database credentials<\/strong>\u00a0by tailing the end of the\u00a0\/tmp\/firstboot.log<\/code>\u00a0file after installation. It is also recommended to remove the\u00a0\/tmp\/firstboot.log<\/code>\u00a0file upon installation. You will be able to access your installation at\u00a0http:\/\/yourip<\/code>.<\/p>\n

Note: This script is meant to run on CentOS 6. It is not guaranteed to work on CentOS 7.<\/em><\/strong><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"","format":"standard","manualknowledgebasecat":[109,110,231,242],"manual_kb_tag":[345,346],"_links":{"self":[{"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manual_kb\/2552"}],"collection":[{"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manual_kb"}],"about":[{"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/types\/manual_kb"}],"author":[{"embeddable":true,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/comments?post=2552"}],"version-history":[{"count":1,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manual_kb\/2552\/revisions"}],"predecessor-version":[{"id":2553,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manual_kb\/2552\/revisions\/2553"}],"wp:attachment":[{"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/media?parent=2552"}],"wp:term":[{"taxonomy":"manualknowledgebasecat","embeddable":true,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manualknowledgebasecat?post=2552"},{"taxonomy":"manual_kb_tag","embeddable":true,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manual_kb_tag?post=2552"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}