Thursday, January 28, 2010

How to determine the size of a file on Linux

I just need to document this one for future reference. Though its very basic but very important on daily sydadmin work. Hopefully, this can help others too.

1. Move the the directory of the file you wish to view the size of.
2. Once in the directory, perform one of the below commands.

ls -l ztibugol.tar.gz

Performing the above command would list output similar to the below information.

-rw-r----- 1 atats atats 11567230 July 07 01:12 ztibugol.tar.gz

In the above output example, the 11567230 is the size of the file. For a more user friendly output, use the du command as shown below.

du -h ztibugol.tar.gz

This command would display the output "12M ztibugol.tar.gz"

If you wish to see the total size of multiple files, type a command similar to the below command.

du -ch *tar.gz

In the above example, the command would list every .tar.gz file in the current directory, display the size of each of those files as it was listing the files, and the total of all the files combined.

Til next time folks...

For further reference, you can check it here.

Friday, January 1, 2010

How to reset/change MySQL root password

I think I should need to post this one so that I can remember if ever I will encounter it again. I tried to study Drupal again for some reason and suddenly when I try to check the database I forgot to note down its root password. Now here comes my Google friend and it helps me out found answers to solved my problem.

Here are the four steps to undertake the process: (By the way, I test this on Jaunty and I could not guarantee if it works also on other Linux distro. But I am 90% sure that it will.)

1. We need to stop mysql from running.

sudo /etc/init.d/mysql stop

2. And then start the mysql configuration.

sudo mysqld --skip-grant-tables &

Before I forgot, on this command the process will not close. So you need to supply the third command.

3. Login to MySQL as root.

mysql -u root mysql

Then this command will login you to mysql command prompt.

4. Replace YOURNEWPASSWORD with your new password.

UPDATE user SET Password=PASSWORD('YOURNEWPASSWORD') WHERE User='root'; FLUSH PRIVILEGES; exit;

And please be reminded also that this method is not regarded as the safest way of resetting the password. However it works for me.

My reference on this one. Click here.

Wednesday, September 30, 2009

Copying DB from Live Site to Staging Site

This summary is not available. Please click here to view the post.

Friday, June 19, 2009

Installing WordPress via DirectAdmin

Hi Folks,

This is my first post here for the tdanotech blog. I was working remotely as a Linux Systems Administrator and also supervising web hosting services. But I was up a challenge lately like installing Wordpress on DirectAdmin. According to some write ups, blogs and other articles on the Internet it is quite easy to install one. But for me as a first timer on the process, I'd really like to try and see for my self how its done. At first I thought I just would like to experience it but later I realized that I'm going to document it in a blog just to summarize what I have learned and to go back later if I need to look what I have done if I will be asked again to do the same.

Three things were assigned to me, set up DNS, nameservers and install WordPress. First thing in my mind was to do it via console so I asked my superior to provide a root password so that I can access the system but he said that it is not needed. So I have no other choice but to do it in DirectAdmin. And so I search for online articles, blogs and other reading materials that will guide me. There are many on the web but it is only focused on installing WordPress but not on DNS, then nameservers and WordPress. And as a challenge I had to do it in from scratch and it took me long enough to get the job done. I will not mention all the curves that I've been through but just only its straightforward installation.

To make it very simple, I would like to do it step by step. Here it is:

1. Open DirectAdmin on a top user account, and so I mean the "admin" account.
2. In our system we have ten available IPs, so for the DNS setup, just click on DNS Administration under the "Admin Tools".
3. Fill up the Domain Name, IP, and the two nameservers. Then click "Add". But you have to check for the available IPs first so that you know which IP you are going to use for the DNS.
4. Assuming that there are no packages configured for the reseller, click "Manage Reseller Packages" and then click "Add Package". You can fill it up or check all the unlimited check boxes. On my case, I see to it that the FTP was set to unlimited. It can be used later. Then save it.
5. Go back to "Home" and then click "Create Reseller" and then click again "Create Reseller". After you fill it up, you can click "Submit". If you have a Fully Qualified Domain Name for your reseller then you can put it on the Domain section but if none you can just put anything that also makes sense to the first domain name you save. Before I forgot, please see to it that the FTP account was set to unlimited also.
6. Go back to "Home" again and click "List Resellers". So there you have the reseller you've created a while ago. If the name of your reseller is "tata", click it and it will bring to you the page "Details for reseller tata".
7. Click on "Login as tata" and it will bring you to the other page. But it is now the page owned by reseller "tata".
8. On the same process, on reseller "tata", on the Account Management section of Home and click "Add Package", fill it up and save it. As a reminder, you can then again set FTP into unlimited.
9. Go back to Home again and then "Add New User", "Create User" and click "Submit".
10. Go back to Home again and then click "List Users" and click on the name of the new user.
11. It will bring you to another page, then click "Login as New User". It will prompt you to sign in as the new user. Fill it up and submit.
12. Bingo! You are now at the third level. On this page. you can now create a database through MySQL Management. Please fill it up and then submit. Be sure to write down the details you entered in creating the database. Or you can use phpmyadmin but in this case I just use MySQL Management.
13. Go back to Home and then create FTP user account through FTP Management.
14. Open your fav FTP client to login with the new account and upload WordPress files. It may take some time depending on the speed of your Internet. But more or less it will upload 1000+ files. After this is done, upload also the wp-config.php to the WordPress directory with the correct database user, database name and password.
15. On the other hand, register yourself with WordPress because that account will be needed during its installation.
16. Open up your browser with the URL of your WordPress directory (http://your_website/~your_user/wordpress/). Hoollah! There goes your WordPress, fill it up and install it.

I do really hope that this can be of great help to those who need a guide in installing WordPress via DirectAdmin with the same requirements. Or you can modify the guide to fit in your needs.

So, until next time!

Please fell free to post some comments and suggestions. Thank you and more power.