These are notes on ONE path through settng up an Ubuntu Linux server and using it to support a full CRUD Web installation. The following notes can be used to supplement the instruction: Install linux, Apache, MySQL, PHP, security certificate, WordPress... to support a full CRUD web installation using the Web as a guide for instructions.
Install procedures change, so you will have to adapt these suggestions to your current circumstances. These are suggestions and intended as "helpful hints" about how to construct your system under AWS. But you will have to fill in the blanks, read other tutorials on the web, and talk with your classmates if you run into challenges.
You can try these Basic Unix Command Tutorial and Unix command reference card or find your own version on the web.
If you are using emacs, you can use M-x, manual-entry to look up the manual entry for any unix command.
[Answer Y to Do you want to continue?] [This install will take a while...]
ubuntu@ip-172-31-28-16:~$ ps -ef | grep apache2 root 14378 1 0 04:54 ? 00:00:00 /usr/sbin/apache2 -k start www-data 14380 14378 0 04:54 ? 00:00:00 /usr/sbin/apache2 -k start www-data 14381 14378 0 04:54 ? 00:00:00 /usr/sbin/apache2 -k start ubuntu 14613 2432 0 04:55 pts/1 00:00:00 grep --color=auto apache2 ubuntu@ip-172-31-28-78:~$
Trying 127.0.0.1... Connected to localhost. Escape character is '^]'.
Your browser sent a request that this server could not understand.
Securing the MySQL server deployment. Connecting to MySQL using a blank password. VALIDATE PASSWORD PLUGIN can be used to test passwords and improve security. It checks the strength of password and allows the users to set only those passwords which are secure enough. Would you like to setup VALIDATE PASSWORD plugin? Press y|Y for Yes, any other key for No: N
root@ip-172-31-45-12:~# mysql -uroot -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 4 Server version: 5.7.27-0ubuntu0.18.04.1 (Ubuntu) Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> show tables; show tables; ERROR 1046 (3D000): No database selected mysql> use mysql; use mysql; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed mysql> show tables; show tables; +---------------------------+ | Tables_in_mysql |
Contents (three lines):<?php phpinfo(); ?>
Use, e.g.: Country Name: US State: IL Locality: Chicago Organizaton: DePaul-394 [Note: Leave the rest blank if you like, but maybe put in your email address] You are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter '.', the field will be left blank. ----- Country Name (2 letter code) [AU]:US US State or Province Name (full name) [Some-State]:IL IL Locality Name (eg, city) []:Chicago Chicago Organization Name (eg, company) [Internet Widgits Pty Ltd]:DePaul394 DePaul394 Organizational Unit Name (eg, section) []: Common Name (e.g. server FQDN or YOUR name) []: Email Address []:elliott@depaul.edu elliott@depaul.edu
Inbound rule. Edit Add Add a rule for HTTPS, port 443.
Advanced Accept the Risk and Continue At this point you should see the index.html file again.
Click on the lock in the browser address bar: Expand connection More information View Certificate
In /etc/apache2/sites-enabled/default-ssl.conf
SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key # SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem # SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key and replace them with: SSLCertificateFile /etc/ssl/certs/apache-selfsigned.crt SSLCertificateKeyFile /etc/ssl/private/apache-selfsigned.key
Expand connection More information View Certificate You should now see the DePaul394 organization you put into your own self-signed certificate. Congratulations! Good job.
root@ip-172-31-nn.-nn:~# ps -ef | grep apache2 ps -ef | grep apache2 root 2662 1 0 16:34 ? 00:00:00 /usr/sbin/apache2 -k start www-data 3338 2662 0 20:00 ? 00:00:00 /usr/sbin/apache2 -k start www-data 3339 2662 0 20:00 ? 00:00:00 /usr/sbin/apache2 -k start www-data 3340 2662 0 20:00 ? 00:00:00 /usr/sbin/apache2 -k start www-data 3341 2662 0 20:00 ? 00:00:00 /usr/sbin/apache2 -k start www-data 3344 2662 0 20:00 ? 00:00:00 /usr/sbin/apache2 -k start www-data 3345 2662 0 20:00 ? 00:00:00 /usr/sbin/apache2 -k start root 3423 27409 0 20:09 pts/1 00:00:00 grep --color=auto apache2
Configure database for phpmyadmin with dbconfig-common? [yes/no] yes Provide a password. DON'T LOSE THIS. WRITE IT DOWN. Place the password in your local file. [...] Determining localhost credentials from /etc/mysql/debian.cnf: succeeded. dbconfig-common: writing config to /etc/dbconfig-common/phpmyadmin.conf Creating config file /etc/dbconfig-common/phpmyadmin.conf with new version Creating config file /etc/phpmyadmin/config-db.php with new version checking privileges on database phpmyadmin for phpmyadmin@localhost: user creation needed. granting access to database phpmyadmin for phpmyadmin@localhost: success. [...] At this point you should be able to use phpmyadmin to query and modify your MySql database with the GUI interface: https://18.189.n.n/phpmyadmin/ [use your fixed (elastic) IP address] Username: phpmyadmin PW: whatever you chose
OLD: # Include list of ports to listen on Include ports.conf NEW: (one line addition) # Include list of ports to listen on Include ports.conf Include /etc/phpmyadmin/apache.conf
OLD:SSLOptions +StdEnvVars NEW:SSLOptions +StdEnvVars AuthType Basic AuthName "DePaul394" AuthUserFile /etc/apache2/.htpasswd require valid-user
New password: Re-type new password: Adding password for user elliott
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> create database wordpress; create database wordpress; Query OK, 1 row affected (0.00 sec)
mysql> GRANT ALL ON wordpress.* TO 'wordpressuser'@'localhost' IDENTIFIED BY 'YOURPASSWORD';
mysql> \q Bye
OLD:AuthType Basic AuthName "Enter Username and PW:" AuthUserFile /etc/apache2/.htpasswd require valid-user NEW:AuthType Basic AuthName "Enter Username and PW:" AuthUserFile /etc/apache2/.htpasswd require valid-user AllowOverride All
latest.tar.gz wordpress
/var/www/html/wordpress: total used in directory 208 available 5699916 drwxr-xr-x 5 nobody nogroup 4096 Sep 5 01:08 . drwxr-xr-x 3 root root 4096 Sep 16 01:06 .. -rw-r--r-- 1 nobody nogroup 420 Nov 30 2017 index.php -rw-r--r-- 1 nobody nogroup 19935 Jan 1 2019 license.txt -rw-r--r-- 1 nobody nogroup 7447 Apr 8 22:59 readme.html -rw-r--r-- 1 nobody nogroup 6919 Jan 12 2019 wp-activate.php [etc.]
total 200 -rw-r--r-- 1 www-data www-data 420 Nov 30 2017 index.php -rw-r--r-- 1 www-data www-data 19935 Jan 1 2019 license.txt -rw-r--r-- 1 www-data www-data 7447 Apr 8 22:59 readme.html -rw-r--r-- 1 www-data www-data 6919 Jan 12 2019 wp-activate.php drwxr-xr-x 9 www-data www-data 4096 Sep 5 01:08 wp-admin -rw-r--r-- 1 www-data www-data 369 Nov 30 2017 wp-blog-header.php -rw-r--r-- 1 www-data www-data 2283 Jan 21 2019 wp-comments-post.php -rw-r--r-- 1 www-data www-data 2898 Jan 8 2019 wp-config-sample.php [etc.]
total 200 -rw-r----- 1 www-data www-data 420 Nov 30 2017 index.php -rw-r----- 1 www-data www-data 19935 Jan 1 2019 license.txt -rw-r----- 1 www-data www-data 7447 Apr 8 22:59 readme.html -rw-r----- 1 www-data www-data 6919 Jan 12 2019 wp-activate.php drwxr-x--- 9 www-data www-data 4096 Sep 5 01:08 wp-admin -rw-r----- 1 www-data www-data 369 Nov 30 2017 wp-blog-header.php [etc.[]
define('AUTH_KEY', '`IB[%op3Z$cH>ak~SE62(9BH.yA5K{+p`]UW#1/p7UQq O+x+*89bzgq)u|ZNve?,,fPN:P1QW-Pu_hU3|JVY+0eG/T*Z[)L@#dD'); define('LOGGED_IN_KEY', ':n+yc<&|+`!e31U;.GPws-WCaZ~KgHu_8<|q$-Voc5j_Vi?ZF-HQ{;r7F{RPmW||'); define('NONCE_KEY', 'N|yJ=szUDTitC-$qh<~3JO+TC+Uq2@Pu#aHA1:baW}pEt.7+SnHLGW -,ub-7nHCCDF*#hslhho9x|%R?.UR<@T0-6+{)c>>.?5UU2=;K;|A?t^1np_'); define('LOGGED_IN_SALT', '?V#Mj|)IA#5:f38ccAuu<4fs)(i>DYJ,%0s[zocg1Tn$kL%-Fh-y>5>_.:iQ1l0u'); define('NONCE_SALT', 'L|z^uaZgKJ@/[!waB!g]f Ok{+.],R{[HynpAp - Edit the wp-config.php file. In it replace:
OLD: */ define( 'AUTH_KEY', 'put your unique phrase here' ); define( 'SECURE_AUTH_KEY', 'put your unique phrase here' ); define( 'LOGGED_IN_KEY', 'put your unique phrase here' ); define( 'NONCE_KEY', 'put your unique phrase here' ); define( 'AUTH_SALT', 'put your unique phrase here' ); define( 'SECURE_AUTH_SALT', 'put your unique phrase here' ); define( 'LOGGED_IN_SALT', 'put your unique phrase here' ); define( 'NONCE_SALT', 'put your unique phrase here' ); /**#@-*/ With NEW: [Insert the defines given above, filled with authentication secrets. Don't show these to anyone!]- In wp-config.php, also change the following:
/** * WordPress Database Table prefix. * OLD: // ** MySQL settings - You can get this info from your web host ** // /** The name of the database for WordPress */ define( 'DB_NAME', 'database_name_here' ); /** MySQL database username */ define( 'DB_USER', 'username_here' ); /** MySQL database password */ define( 'DB_PASSWORD', 'password_here' ); /** MySQL hostname */ define( 'DB_HOST', 'localhost' ); NEW: // ** MySQL settings - You can get this info from your web host ** // /** The name of the database for WordPress */ define( 'DB_NAME', 'wordpress' ); /** MySQL database username */ define( 'DB_USER', 'wordpressuser' ); /** MySQL database password */ define( 'DB_PASSWORD', 'YOUR_MYSQL_PASSWORD' ); /** MySQL hostname */ define( 'DB_HOST', 'localhost' ); /** NOTE ADD THIS FIELD: */ define('FS_METHOD', 'direct'); /** Database Charset to use in creating database tables. */ define( 'DB_CHARSET', 'utf8' ); /** The Database Collate type. Don't change this if in doubt. */ define( 'DB_COLLATE', '' );- Bring up WordPress in your Browser:
- https://18.189.n.n/wordpress [Use your own elastic (fixed) IP address here]
- When Wordpress comes up in your browser:
- Select English (United States)
- WRITE DOWN YOUR PASSWORD (and username). DON'T LOSE THEM! Place them in your local file.
Site Title: DePaul-394-WordPress Username: YOU CHOOSE Password: YOU CHOOSE- Put in your email. You can use this to log in later in a pinch.
- I recommend that you discourage searh engines for this student site.
- Press the INSTALL WordPress button.
- Congratulations, you have installed WordPress.
/var/log/apache2/