Wednesday, July 27, 2011

Install phpmyadmin to operate MySQL from web

In my last post, we saw how to setup a LAMP on AWS. Let's have a look into how to install phpmyadmin on your linux server.

To install phpmyadmin to operate MySql from web browser, web server is needed.

Steps to install phpmyadmin:
1. yum -y install phpMyAdmin php-mysql php-mcrypt
2. vi /etc/httpd/conf.d/phpMyAdmin.conf
3. Add IP address you allow on line #14
Allow from 127.0.0.1
4. Close Editor
5. Reload the httpd process
/etc/rc.d/init.d/httpd reload

Once you are successfully run the above 6 steps, phpmyadmin is installed on your server.

Now we will see how we can access phpmyadmin.

Access to 'http://(your hostname or IP address)/(alias name you set)/' with web browser.
Alias name is by default 'phpmyadmin'.

When you enter above url on browser, it will ask you the login credentials for MySql user.
You can enter MySql user login credentials, can able to see phpmyadmin dashboard.

Wednesday, July 6, 2011

Getting started with Amazon EC2 and PHP – MySql

Do you know nothing about AWS or linux, but want to run PHP/MySql server set up on AWS? Are you new comer on AWS?
I was like you, relying on webhosting services to manage/configured on servers, so it was tough to work on AWS EC2 but later I feel it’s simpler.
In this tutorial I will show you how to setup PHP and MySql and how to make it web-accessible.

AWS:
Amazon has different products, but we are more interested in Amazon Elastic Compute Cloud (EC2).
Click on link and Sign up for Amazon EC2.
Once you have setup for EC2, go to AWS Console and click on Instance in left hand side panel.
You can see more details on Amazon documentation.
Now you create a Key Pair - this will be the credentials you will use to SSH.
Next is the Security Group - which will be used to specify the firewall used for your instance.
For now use the default Group and add port numbers as you want to open.
Now Elastic IP address — In the AWS Management Console, click on “Elastic IPs”, then “Allocate New Address” under “Addresses”. Once the address is created, click on it, then “Associate Address”. Select the instance and associate it.

You should now be able to SSH into your instance using your .pem file.
Now question is how do I access my instance? Couple of Software.
PuTTY.exe — Secure Shell client
PuTTYgen.exe — SSH public/private key generator
Putty available at your finger tip, For that you need http://www.putty.nl/download.html

Configuring the Linux Server:
We have got server up and running, now lets setup some packages.
I’ll show you how to set up PHP and MySQL on the server.

PHP:
sudo yum install php-mysql php php-xml php-mcrypt php-mbstring php-cli mysql httpd
Press ‘y’ for each of the prompts that show up. Note that you’re logged in as ec2-user, so you need to sudo all of these command (No need on fedora).
You should now be able to create and run a PHP sample file.

MySql:
Install MySql server.
sudo yum install mysql-server
Now start the mysql server
sudo /etc/init.d/mysqld start
Next, set the root password.
mysqladmin -u root password '[PASSWORD]'
Now we set up two users for MySQL: the administrator, which you’ll use to create and modify tables; and the app user, which the app will use to query the DB (with more limited privileges).
Log into MySQL as root (mysql -u root -p) for mysql prompt.
If you want to grant privileges for other server (MySql is not setup on same server)then type following command
GRANT ALL PRIVILEGES ON *.* TO root@'SCRIPTSERVERIPADDRESS' IDENTIFIED BY 'MYSQLUSERNAME' WITH GRANT OPTION;
FLUSH PRIVILEGES;
Now you have PHP and MySql running on server, but cannot accessible though browser.

Make it web accessible:
Now we need to configure the web server.
To set up web server, we need to modify config file which is httpd.conf, located at /etc/httpd/conf/httpd.conf.
You can open this file using editor, I used vi.
Now go to bottom of the file, where there is a small section on the VirtualHost.
Add the following code in it.
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot [your document root]
ServerName [your server name]
ErrorLog logs/dummy-host.example.com-error_log
CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>

Note: If you are planning to run multiple sites on same server, you can add multiple virtual host section with document root and server name changes according to site.

Now restart the httpd process or server using following command.
sudo /etc/init.d/httpd restart


Using two Instances


It will be better to separate the web/script server and the DB server. For this, you will need to set up two Instances with two Elastic IPs, one of which has the web server httpd running, and the other of which has the mysql server mysqld running.
To make accessible on the web, instead of using “localhost” as the MySQL host, use the IP address of the MySQL instance. On the DB instance, set up your grant permissions (Given the query in MySql section) to allow db from anywhere.

Now you are done with setting up Amazon server and your server is loaded with PHP and MySql.
In upcoming blogs, I will introduce you with FTP server setup and phpmyadmin setup.

Monday, July 4, 2011

Time Management

Everyone wants to make the most of their time. You recognize that time is a unique and precious resource that you need in order to do your work, accomplish your goals, spend time with your loved ones, and enjoy everything that life has to offer.
Perhaps you have a heavy workload and want to find ways to become more effective so you can get more done in less time.
Maybe you feel overwhelmed or “stressed out” and want to find ways to do less and enjoy more. Or maybe you simply want to feel more focused and in control of your time, instead of feeling like you rush madly from one activity to the next until you fall into bed exhausted every night.
A Thought, “Do you love life? Then do not squander time, for that's the stuff that life is made of.”

What Exactly Is Time Management?

Time management is a set of principles, practices, skills, tools, and systems working together to help you get more value out of your time with the aim of improving the quality of your life.
The important point is that time management is not necessarily about getting lots of stuff done, because much more important than that is making sure that you are working on the right things, the things that truly need to be done.
Smart time managers know that there is much more to do than anyone could possibly accomplish. So instead of trying to do it all, smart time managers are very picky about how they spend their time.
They choose to focus and spend their time doing a few vital projects that will really make a difference, rather than spending all their time doing many trivial things that don't really matter all that much.
If you become a good time manager, you’ll not only get a lot more done in less time, but you’ll feel more relaxed, focused and in control of your life.
You’ll be able to use your time in a much more balanced and effective way and you’ll be able to make time for the people and activities that you love. When you get to the end of a busy day, you’ll feel a strong sense of accomplishment from everything that you actually got done.
Improving your time management skills can even help you get better results by doing less work, because you're focusing on the things that really matter rather than all the low-priority busywork that just keeps you busy.
If you don’t learn how to manage your time well, you’ll be far less productive than you could be and you’ll get a lot less done. You’ll also feel much more stressed and overwhelmed, and you’ll struggle to find time to spend with the people you care about and to do the things you enjoy.

Learning Time Management Skills

In the end, time management comes down to choices. Good choices lead to better results, while poor choices lead to wasted time and energy.
The good news is that time management skills can be learned and mastered by anyone. All it takes is practice and dedication.
Like any other skill, you can teach time management the easy way or you can learn it the hard way.
The hard way usually involves years of trial and error and lots of false starts trying to figure out what works and what doesn't.
If you'd like to save yourself some time, money and effort, I recommend you try the easy way: learn from someone who has already done it.

15 Time Management Tips

Here are 15 practical time management tips to help you get started...

1. Write things down
A common time management mistake is to try to use your memory to keep track of too many details leading to information overload. Using a to-do list to write things down is a great way to take control of your projects and tasks and keep you organized.

2. Prioritize your list
Prioritizing your to-do list helps you focus and spend more of your time on the things that really matter to you. Rate your tasks into categories using the ABCD prioritization system described in the time management course.

3. Plan your week
Spend some time at the beginning of each week to plan your schedule. Taking the extra time to do this will help increase your productivity and balance your important long-term projects with your more urgent tasks. All you need is fifteen to thirty minutes each week for your planning session.

4. Carry a notebook
You never know when you are going to have a great idea or brilliant insight. Carry a small notebook with you wherever you go so you can capture your thoughts. If you wait too long to write them down you could forget. Another option is to use a digital recorder.

5. Learn to say no
Many people become overloaded with too much work because they overcommitted; they say yes when they really should be saying no. Learn to say no to low priority requests and you will free up time to spend on things that are more important.

6. Think before acting
How many times have you said yes to something you later regretted? Before committing to a new task, stop to think about it before you give your answer. This will prevent you from taking on too much work.

7. Continuously improve yourself
Make time in your schedule to learn new things and develop your natural talents and abilities. For example, you could take a class, attend a training program, or read a book. Continuously improving your knowledge and skills increases your marketability, can help boost your career, and is the most reliable path to financial independence.

8. Think about what you are giving up to do your regular activities
It is a good idea to evaluate regularly how you are spending your time. In some cases, the best thing you can do is to stop doing an activity that is no longer serving you so you can spend the time doing something more valuable. Consider what you are giving up in order to maintain your current activities.

9. Use a time management system
Using a time management system can help you keep track of everything that you need to do, organize and prioritize your work, and develop sound plans to complete it.

10. Identify bad habits
Make a list of bad habits that are stealing your time, sabotaging your goals, and blocking your success. After you do, work on them one at a time and systematically eliminate them from your life. Remember that the easiest way to eliminate a bad habit, it to replace it with a better habit. In these days it’s a social networking addiction.

11. Don’t do other people’s work
Are you in the habit of doing other people’s work because of a ‘hero’ mentality? Doing this takes up time that you may not have. Instead, focus on your own projects and goals, learn to delegate effectively, and teach others how to do their own work.

12. Keep a goal journal
Schedule time to set and evaluate your goals. Start a journal and write down your progress for each goal. Go through your goal journal each week to make sure you are on the right track. Keeping a journal on your computer has never been easier!

13. Don’t be a perfectionist
Some tasks don’t require your best effort. Sending a short email to a colleague, for example, shouldn’t take any more than a few minutes. Learn to distinguish between tasks that deserve to be done excellently and tasks that just need to be done.

14. Beware of “filler” tasks
When you have a to-do list filled with important tasks, be careful not to get distracted by “filler” tasks. Things such as organizing your bookcase or filing papers can wait until you tackle the items that have the highest priority.

15. Avoid “efficiency traps”
Being efficient doesn’t necessarily mean that you are being productive. Avoid taking on tasks that you can do with efficiency that don’t need to be done at all. Just because you are busy and getting things done doesn’t mean you are actually accomplishing anything significant.

I have learned this stuff from my managers and from my past experience. Do share your thoughts here to make time more precious.