I finally got the login figured out, I just didn't have the right user name a couple of days ago. Again, I followed the directions here: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EC2_GetStarted.html
The key was to use the proper user name for that image that was booted for my instance.
ssh -i TestingForClass.pem firstname.lastname@example.orgOf course this is not my real server number, you have to look your instance server name up on the amazon site in aws -> ec2 -> instance or https://console.aws.amazon.com/ec2/v2/home?region=us-east-1 Again, your home may be in a different region, but you can jump around between regions very easily too.
The -i followed by the filename.pem file is that private key that you downloaded when you were setting up the system following my other directions: http://mystry-geek.blogspot.com/2013/01/ran-cloud-server-today-for-first-time.html Remember to never lose this file, because you cannot download a new one. I'm not even sure how you would recover from losing this file.
Once I connected a banner came up from the system giving some info. The system recommended that I install updates, which I did, then I rebooted, not because I had to, but because I wanted to see what would happen.
sudo yum updateAbout 40 packages were quickly updated.
sudo shutdown -r nowOf course this logged me out, and after a couple of minutes I was able to ssh back into the terminal. It is great that the server didn't stop because it was restarted.
Now I wanted to see what services were installed on the system so I changed to
cd /etc/init.dIt only had a minimal set of services running to be as secure as possible. Now, I need a LAMP server for class. I already had the Linux, but now I needed the AMP. So I ran the command
sudo yum install apache php mysql mysql-server
sudo ./httpd startYou want to make the database safer to run so run this command and follow the prompts:
/usr/bin/mysql_secure_installationThen you can run the mysql server
sudo ./mysqld startIf you type the hostname you found from your instance data on the ec2 instance console you will see a default page, but that is ugly and we must change that. Plus you don't know if that is your box, or someone else's unconfigured box, so we must find out.
A non working example using the same fake hostname I made up for my ssh login above is :
You must find and use your real hostname or this won't work.
If you can't see anything here, then you may not have opened up ports 80 and 443 in the security tab for your instance. I know that I did and I still don't see anything, so checking on the box for port 443 tells me the following;
Running this command in the ssh terminal:
netstat -an | grep 80gives this output:
tcp 0 0 :::80 :::* LISTEN
Which tells me that the web server is listening on port 80.
But running the command:
netstat -an | grep 80Gives no output which means that Apache will have to be configured to listen on the secure port in order to be a secure ecommerce site. I'll will write up an article on Apache by itself.
You want to customize the web page that is showing:
cd /var/www/html/Edit this file to your hearts content. I just did a quick html set of tags, inside that I put a head and body set of tags and inside the body I made a paragraph set of tags and put Hello, World! inside the inner <p> tags.
sudo vi index.html
When I type the url to my box in I see "Hello, World!" so we know that is working.
I still need to test the php, so I make a quick phpinfo.php file:
sudo vi phpinfo.phpAnd type in the following:
<?php phpinfo(); ?>
Then save and quit.
Try to load this file using the same hostname as above followed by /phpinfo.php like this:
After going back and adding the php after the first question mark, it works just great and shows that my server has the required modules that I will need for the class.
Next thing for me to do is to select and try out a framework that I will use to create my e-commerce site for my college class.
Happy webbing, spider friends!