Installing phpMyAdmin Using FTP

In this tutorial, I will explain how you can install PHPMyAdmin on a webserver via FTP using FileZilla or your favorite FTP application. This tutorial assume you are using FileZilla and I am installing a secondary PHPMyAdmin on a Hostgator shared server. The instructions will be the same if you are installing a primary installation of PHPMyadmin, but it is worth knowing that if you already have a Cpanel with PHPMyAdmin access, you can still add another installation of PHPMyAdmin in a domain’s root folder for use with that domain name in case you may not have Cpanel access or maybe to give a developer simple access to Mysql.

What you’ll need

  1. FileZilla – if you don’t have an FTP client, Google FileZilla and install it before you start.
  2. Recent download of PhpMyAdmin – this can be found at http://www.phpmyadmin.net/home_page/downloads.php
  3. A web server or hosting account such as Hostgator, Godaddy or Amazon Ec2. I have installed PHPMyAdmin on all of these.
  4. A simple text editor such as notepad or notepad++.

Installing PHPMyAdmin

  1.  After downloading from he link above, unzip the phpMyAdmin folder on your desktop, open the unzipped folder and rename the sub-folder named “phpMyAdmin-4.2.8-english” to simply “phpmyadmin” for easier access later. Be sure that you rename the folder inside of the main folder, not the top level folder.
  2. Upload the phpmyadmin folder to your server in the web root directory for your domain name using FileZilla.
  3. After the files have all uploaded, using FileZilla, open the phpmyadmin folder and create a new directory named “config” inside of phpmyadmin. Give the folder writable permissions. To change permissions right click on the config folder and select to change file permissions and set them to 777 for now. You can tighten security later when your done setting it up.
  4. Open your web browser and navigate to http://example.com/phpmyadmin/setup/, but change example.com to your domain name and follow the instructions on screen.  Go to next step or read on for alternative manual  config method. If you want to configure manually instead, In the phpmyadmin folder on your desktop, look for the file named “config.sample.inc” and open it in a text editor such as notepad or notepad++. You can edit it by hand and upload to config(but I haven’t tested this recently)
  5. While still on the page you landed on at example.com/setup, scroll down to where you see the “New Server” button and click it to set up your server. If you don’t know what to do here, the best advice I can give you is to simply leave it be and select only an authentication method such as “http” and click “Apply” to have your server set up with defaults. I think the auth method is the most important setting to get you going quickly. If you use http auth method, you will simply need the user and password of an existing database to access it. If you don’t have that, use one of the other auth methods. If you don’t understand auth methods, click on the question mark next to each in the setup server dialog to read the documentation on it.
  6. After setting up your server, go to example.com/phpmyadmin and login and you should now see the database you logged into. If not, go back and edit your server settings until you get it to work.

NOTE:

doing a secondary install separate from Cpanel can be handy to access a single database for a single website, but if you do have Cpanel user and password, you can actually access all databases. Also, using Cpanel user and password, you can create new databases!

Summary

That’s it, I got lucky and mine worked with just setting the authentication type to http and using an existing mysql database user and password to access phpmyadmin, but if you didn’t have such good luck, refer to the phpMyAdmin documentation linked to in several locations in the setup area.

I did note the secondary phpMyAdmin installation ran slower than normal, but it did work. I think next time I will try an older version of phpMyadmin just to see if it is faster. Good Luck!

Amazon Web Server 5 Minute Install

This tutorial will show you how to set up an Amazon cloud server n just over five minutes! It assumes you already have an Amazon account created. If you have to create an account, see my more detailed article on creating an Amazon cloud web server HERE

Here are the high end steps to create a web server from Amazon’s EC2 tab:

  1. From the EC2 tab, click “Launch Instance” near the top of the page and then click on “continue” with the default “classic wizard” selected.
  2. In the next dialog you will see, click the very first “select” button to select the basic Amazon Linux AMI.
  3. In the next dialog, you’ll be asked to select a zone. If you already have a security group created for another instance that you want to use, select the same availability zone, otherwise just click “Continue” with the default selected.
  4. The next dialog is for advanced options, just click continue to accept the defaults. Then in the next window, click continue again to accept the default root volume which will work fine.
  5. The next dialog window is for Key Value Pairs, Enter a friendly name for your server in the first value input and click “continue”.
  6. The next step allows you to choose an existing key pair or create a new one. Do so and click “continue”. Then choose a security group from a previous instance or choose the one with “default” in the name if you haven’t created one in the past. If you have custom needs, create a custom security group. Click “Continue”. Then click “Launch” and “Close” in the next two windows and your instnace has been created. It may take a minute or two to set up in the background.
  7. Loginto your instnace using the puglic IP address which you can get by checking the instance in your amazon console and making a note of the IP address. it will look something like: http://ec2-54-242-44-14.compute-1.amazonaws.com/, but you can shorten it by taking the number after the ec2 part so that the above would shorten to 54.242.44.14 which is the IP address only. Notice I replaced the dashes with periods.
  8. Open Putty and enter your server’s IP address form the last step into the host field. Click on “SSH” from options on left of Putty window then click on the “Auth” subcategory and use the browse button to allow Putty access to your key file which you should have downloaded to your desktop when creating it for the first time. If you have not done this yet, look in Amazon’s help section for instructions on downloading your key file. After selecting the key file, click on open to open it, then open again to open a terminal window and finally click yes to add a security exception and you will be connected to your instance. Enter “ec2-user” into the terminal window when it asks for a user name and hit enter.
  9. Now it’s time to install some stuff. FIrst update your server’s software by typing “sudo yum update” then when that is done, type the following series of command line commands to install PHP, MySQL and PHPmyAdmin:

sudo yum install php-mysql php php-xml php-mcrypt php-mbstring php-cli mysql httpd

sudo yum install mysql-server

sudo /etc/init.d/mysqld start

mysqladmin -u root password UrPassWord

mysql -u root –p

If you get a MySQL prompt, you are good so far. Type q to exit MySQL and continue from the command prompt as follows:

sudo vim /var/www/html/index.php

Now enter some test text for your first test webpage.

Save the page and start your new server with

sudo service httpd start

Type the IP address in a web browser and if you see your test text from above, you are done! otherwise, go back and find your error. Good Luck! If you need a more detailed set of instructions, see my first post on setting up a cloud server at http://jafty.com/blog/?p=142

.

(Also read: MangoMatter Media provides the best web hosting services. Visit their website today to know more)

 

 

How to Install a Web Server on Amazon EC2

This is a step by step tutorial on how to install a web server on an Amazon Linux AMI in EC2. I, Ian L. of Jafty.com, have personally used this method to set up well over a dozen web servers for myself and my clients. I have perfected this method and edited the directions according to what I have found works the best. Take note where I noted that you do not need to make database tables if you don’t want to and you plan to install PHPmyAdmin as instructed towards the end of the tutorial. Have fun!

Starting a Free Amazon Web Server:

Sign up for an Amazon Web Services account:

The first step to migrating your website to the cloud is to sign up for AWS using the link below.

Go to http://aws.amazon.com/ and sign up.

Next, you need to set up your account before you can launch a server into the cloud. Start by going to https://console.aws.amazon.com/console/home and following these few steps to set up your account for the cloud:

  1. Click the “EC2” tab.
  2. On the left column of the page, under the “Network & Security” heading, click on “Security Groups”.
  3. In the right column click on the “Create Security Group” button. Enter a name and description in the pop up window then hit the “yes create” button.
  4. Just under the “Create Security Group” button is a list of existing groups. Your new group should be here. Make sure it is the only one checked.
  5. Further down in the right column click on the “inbound”  tab and set up your server’s ports. Here is another tutorial I wrote on how to set this up that you should take a look at because it is a little complex and very important to get correct the first time: http://jafty.com/blog/amazon-cloud-server-security-rules/(link opens in new window or tab). This has changed a little and now you don’t have to do this here if you don’t want to…or if you do it wrong, you can have another chance when you are setting up your instance. If you do it when you set up your instance, refer to the same link just mentioned as well and you’ll be okay.

 

  1. Make sure you click on the button that reads “Apply Rule Changes” once you have the ports set up like we do in the above image.
  2. Now go back to the left navigation column of the page and click on the “key pairs” link.
  3. Click “Create Key” in the right column.
  4. Give the key pair a name that relates to your server like “iansserver” and save it to your local machine. Save it to the desktop or somewhere you can find it easily because you will need it soon.

Creating a server instance in the cloud

Now comes the fun part! We are going to create a virtual private server or VPS in the cloud on amazons network of servers for little or no cost at all! Currently as of March 2012, Amazon allows new users to receive a year of free services. Be careful though, there are limitations, so monitor your account to make sure you only use services on the free tier and that you don’t exceed any set limitations. Read online support for more information on charges that could apply. Follow the following steps to set up a free micro instance of a Linux web server complete with web server, PHP, database server and PHPMyAdmin. Those are the minimal things you should definitely have to create dynamic web sites.

  1. Picking up on the same page we left off on above, click on “instances” in the left navigation column of the amazon webpage.
  2. Click “Launch Instance” to make the instance wizard appear. Make sure “Classic Wizard” is selected in the pop up and click on “Continue”.
  3. On the “Choose an AMI” pop up, select the AMI that reads “Basic 64-bit Amazon Linux AMI ” it will have a notice by it indicating it is in the free usage tier. Check the box to select this AMI and click “Next…”.
  4. In the “instance details” and the step after it, just accept the defaults by clicking on “Next…” two times.
  5. You should now be at the point where there is a key and value column. Leave “name” in the key column and enter a name that describes your server in the value column like “64bit_linux”. Click Continue.
  6. Now you should be on the “create key pair” pop up. Select the key pair name you saved earlier in step 9 above and click continue.
  7. Now in the “configure firewall” pop up, select the preexisting security group you named earlier and click continue.
  8. Review your settings and click “Launch”. Click on “View your instances on the Instances page” and watch your new cloud server appear under “My Instances”.
  9. Check the instance name and make sure no others are checked.
  10. Look down below and find where it gives details for the checked instance. Start a notes page in notebook to record important info and copy and paste the public DNS address for safe keeping you will need it soon.
  11. Open PuttyGen and click on file/load private key and load in the file you saved to your desktop earlier that has a .pem extension. When it’s loaded, click save private key to save the .pem file as a .ppk file
  12. Open Putty and enter the public DNS where it says “Host name”.
  13. Under “Category” in the left column of the Putty window, click to expand “SSH” then click on “Auth” then click browse and select the .ppk file you saved earlier. Click open.
  14. Now a terminal window should appear asking for a username. First a pop up may appear saying the server’s host key…. Just click yes then Enter “ec2-user” for username in the terminal window and hit enter. If it says “…AMAZON LINUX AMI…” you did good! If not backtrack and find out where you messed up.

Okay congrats, you have successfully launched your bare bones server! There is currently no software on it though, so the next several steps are going to involve installing PHP, a database and required libraries to support them and the web server.

Installing server software on your Amazon EC2 AMI instance

  1. First install PHP and the web server software. Type the following at your command prompt then hit “y” whenever prompted:

sudo yum install php-mysql php php-xml php-mcrypt php-mbstring php-cli mysql httpd

  1. Next install MySQL software. Type the following command and hit “y” when prompted:
sudo yum install mysql-server

 

  1. Start the mysql server by typing:
     sudo /etc/init.d/mysqld start
4.  Set the root password and record it in your notebook page you started earlier for safe keeping. Type:
mysqladmin -u root password UrPassWord
where UrPassWOrd is a unique secure character combo.

NOTE: THE NEXT FEW STEPS ARE OPTIONAL DEPENDING WHAT YOU ARE ATTEMPTING TO DO. YOU DON'T HAVE TO CREATE THE DATABASE TABLES HERE THOUGH, YOU CAN WAIT AND DO SO LATER, AS NEEDED FROM PHPMYADMIN. I included the next three steps to demonstrate how to work with mysql from the command line though as it is a good learning exercise, so you should do it anyway just for the sake of learning.
5.Log into mysql by typing:
mysql -u root –p
then enter the password from step 4.
6.  Type the following commands, hitting enter after each semicolon:
CREATE DATABASE [DataBase NAME];
CREATE USER '[DataBase NAME]_admin'@'localhost' IDENTIFIED BY '[ADMIN PASSWORD]';
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, ALTER ON [DataBase NAME].* TO '[DataBase NAME]_admin'@'localhost';
CREATE USER '[DataBase NAME]_user'@'localhost' IDENTIFIED BY '[USER PASSWORD]';
GRANT SELECT, INSERT, UPDATE, DELETE ON [DataBase NAME].* TO '[DataBase NAME]_user'@'localhost';
7.  Be sure to make a note of both users you created in your notes with the usernames and passwords you used above. Type “exit” then type “sudo chown ec2-user /var/www/html” hit enter to change the owner of the html dir to the ec2-user user.
8.  Type “sudo vim /var/www/html/index.php” and hit enter to start a test .php file as the home page of your new live site on your new cloud VPS.
9.  Hit “I” to put the text editor in insert mode and type some basic HTML to test php and the server. Something like this will do:
<h1>Hello World!</h1>
10.   Hit “ESC” and type “:wq” to save and quit the vim editor. Then start your server with: "sudo service httpd start".
11.   Goto your notepad and get the public DNS address you recorded in your notes earlier. Copy and paste that address to your browswer’s address bar. If it works you should see the bold text: hello world! If it didn’t work and you receive an error with 13 in it, type “sudo chown ec2-user /var/www/html/index.php” and that should fix it.

Okay you now have a working web server! You just need to do some final steps to get the database PHPMYADMIN up and working.

 

Installing PHPMyAdmin

Now let’s install PHPMyAdmin to complete our web server:
Here is how:
1.  Navigate to the html folder:
cd /var/www/html
2.  Type: wget http://www.sourceforge.net/projects/phpmyadmin/files/phpMyAdmin/3.4.1/phpMyAdmin-3.4.1-all-languages.tar.bz2
3.  Unzip by typing: tar -jxf phpMyAdmin-3.4.1-all-languages.tar.bz2 -C /var/www/html
4.  Rename the directory by typing: mv phpMyAdmin-3.4.1-all-languages phpmyadmin
5.  Make a config directory in the phpmyadmin main folder:
cd /var/www/html/phpmyadmin
mkdir config
cp /var/www/html/phpmyadmin/config.sample.inc.php /var/www/html/phpmyadmin/config/config.inc.php
6.  Open config.inc.php in VIM text editor by typing:
sudo vim /var/www/html/phpmyadmin/config/config.inc.php
7.  Find the line that reads “$cfg['blowfish_secret'] = '';” and change it so it reads:
$cfg['blowfish_secret'] = 'yoursecretcode';
You can enter anything you want for your secret code above as long as it’s not over approximately 60 characters.
8.  Find the line that reads “$cfg['Servers'][$i]['AllowNoPassword'] = false;” and change false to true only if you don’t have a root password set or if you are not sure. You can always come back and change this to false again later when you tighten up your server’s security as you will want to do before too long.
9.  Hit “Esc” to get out of insert mode in your text editor. Then type:
:wq 
Type it just like that, including the semicolon, to save and exit the file.
10.   Go to http://your_public_DNS/phpmyadmin/ and enter you mysql admin username and password. You should have recorded these in your notes when setting up the database above in step 7 of the previous section(not this one).

You should now be logged into your new phpMyAdmin section of your VPS server. If so, you have successfully created a cloud VPS server with all of the most essential components to develop a live dynamic PHP website! Once you are done or if you do not intend to use this instance, terminate it so you don’t get billed for it later on after your free year expires. If you intend to use it, do not terminate it or you will lose all of your work!

To learn more about how to connect to an instance go to http://docs.amazonwebservices.com/AWSEC2/latest/GettingStartedGuide/ConnectToInstanceLinux.html and learnn to connect to your instance.

To become root user in putty type:

sudo su

Starting server from putty

Open putty

Enter the public DNS of the server instance which can be found in your AWS dashboard and looks like ec2-50-16-87-242.compute-1.amazonaws.com into the host name field in putty. UPDATE: now Amazon IPs are simply like 45.23.34.22.

In the left column under “category” expand “ssh” and click on Auth

Click browse and select your security key file you created while creating your server instance, it will be a file like: adamskey.ppk you should of saved it on your desktop for convenience.

Click open and your terminal window should come up.

At the login prompt, enter ec2-user and hit enter.

You should see several lines of text with “Amazon Linux AMI” in the middle then a command prompt at the end.

You are now in your server. If you need root access, type sudo su

Reference:

The best tutorial I found on how to get a linux micro instance up and running with a web server  was at:

http://www.alexkorn.com/blog/2011/03/getting-php-mysql-running-amazon-ec2/

Tip: find public data at:

http://aws.amazon.com/publicdatasets/

 

To find out how to use Filzilla with your instance:

http://www.latentexistence.me.uk/how-to-set-up-a-free-linux-server-on-amazon-ec2/

 

 

 

 

 

 

 

Here is how I didn command line server installation second time because above didn’t work:

 

Yum install httpd

Yum install php

Yum install mysql-server mysql

Service httpd start

Service mysqld start

Installing PHP and Mysql Database on Amazon EC2 Cloud Server

Installing PHP and Mysql from Linux command line

Here are the command line commands to get PHP and Mysql onto a Linux server without any software installed yet but basics. I did this on an Amazon Linux AMI:

TIP: Commands are in purple

sudo yum install php-mysql php php-xml php-mcrypt php-mbstring php-cli mysql httpd

sudo yum install mysql-server

sudo /etc/init.d/mysqld start

mysqladmin command to change root password:
mysqladmin -u root password admin

mysql -u root -p

type in password of “admin”

CREATE DATABASE MYSQL;

use MYSQL

CREATE USER ‘MYSQL_admin’@’localhost’ IDENTIFIED BY ‘mypass’;

GRANT ALL PRIVILEGES ON MYSQL TO ‘MYSQL_admin’@’localhost’;

CREATE USER ‘MYSQL_user’@’localhost’ IDENTIFIED BY ‘mypass’;

GRANT SELECT, INSERT, UPDATE, DELETE ON CREATEMYSQL.* TO ‘MYSQL_user’@’localhost’;
exit;

sudo chown ec2-user /var/www/html

sudo vim /var/www/html/index.php

Now you should have a server set up with mysql

Test by opening VI editor and making a test index.html or .php page here is how to open vi and start a new file:

sudo chown e2c-user /var/www/html

sudo vim /var/www/html/index.php

press i and insert some test text then hit esc and type :wq to save the file.

Now start the httpd server using the following command in Putty:
sudo service httpd start

if you got a green “ok” then you are good, if not go over the last several steps and find out what you did wrong.

Go to your Amazon admin console and click on instances to view your instances. Put a check next to the one you just made and copy the url that looks like this:
ec2-54-242-236-133.compute-1.amazonaws.com
you can shorten the url by just using the ip that starts after the ec2- and ends at the first period. Just replace the dashes with periods like this:
54.242.236.133
That is the short URL or IP you can use to access your web server. Type or copy and paste that into your web browser’s address bar and see if you can see your test text you entered with the VI editor a moment ago. If so, you are doing great.

Install phpmyadmin

Next, you can follow the below instructions if you want to install the popular phpmyadmin databaes GUI:

From the server command prompt, type:

cd /var/www/html
wget http://www.sourceforge.net/projects/phpmyadmin/files/phpMyAdmin/3.4.1/phpMyAdmin-3.4.1-all-languages.tar.bz2

tar -jxf phpMyAdmin-3.4.1-all-languages.tar.bz2 -C /var/www/html

mv phpMyAdmin-3.4.1-all-languages phpmyadmin

cd /var/www/html/phpmyadmin

mkdir config

cp /var/www/html/phpmyadmin/config.sample.inc.php /var/www/html/phpmyadmin/config/config.inc.php

sudo vim /var/www/html/phpmyadmin/config/config.inc.php

change  blowfish_secret to any other word and change allownopassword to true

go to: your server’s URL that looks something like http://33.234.51.182/phpmyadmin/
and enter user of root and the root password or one of the other users and passwords you created in this exercise. If you get the phpmyadmin interface, you did good.