Showing posts with label Server Administration. Show all posts
Showing posts with label Server Administration. Show all posts

Mar 3, 2015

Scheduling Automatic Restart of Windows 7

One of the lessons I have learnt with server administration is that after a while of running tomcat servers, the system can get really sluggish from all the "living objects". One of the solutions for this is to do a daily scheduled reboot of the server to keep the system fresh and performing at its best (of course you also need to fix the reason as to why objects are not being pushed into garbage collection).

So, here is how you create a scheduled restart for Windows machines (This was tested for Windows 7):
  1. Start Notepad,
  2. type c:\windows\system32\shutdown.exe -F -R
  3. Save the file as "AutoRestart.bat" somewhere on disk
  4. Now, Launch Task Scheduler.
  5. Click Action and select Create Basic task.
  6. Type AutoRestart (or others you want) in the Name box and click Next.
  7. Select Daily and click Next
  8. Type the time you want to restart the computer and click Next.
  9. Select Start a program and click Next.
  10. Click Browse and navigate to where you saved AutoRestart.bat, select the AutoRestart.bat file and click Next.
  11. Click Finish.
  12. To test if your auto-restart works, go back to task scheduler and when you see the list of scheduled tasks, right click on AutoRestart and select run.

Nov 13, 2013

How to install MySQL on an Amazon EC2 Server Instance?

Being a newbie to server administration especially with Linux, I found myself looking all over the internet on how to install a mysql server instance! Here is what worked for me on the Amazon EC2 instance:

To install a MySQL Server

  1. First step is to of course ssh into the EC2 instance
  2. Then, at a command prompt, use the following command to install MySQL Server:
    sudo yum install mysql-server
    
    When you are prompted, type 'y'.

To start the installed MySQL Server

  1. Start mysql, and configure it to start up automatically on reboot.
    sudo chkconfig mysqld on
    sudo service mysqld start
    
    You would see a response like the following.
    Starting mysqld

Configuring newly installed MySQL Server

  1. To update the password of root user do the following:
  2. mysqladmin -u root password [your_new_pwd]
  3. To create a database do the following:
    mysqladmin -u root -p create [your_new_db]
    When you are prompted for a password, type [your_new_pwd]. Well that's it. There rest of the MySQL functionality is as usual. For more details on other functionalities please use the MySQL website.

Using MySQL Externally

If you need to access MySQL from another server, then you need to execute these following additional steps.
  1. First off, create a MySQL user who can connect from any type of host using the following SQL:
    GRANT ALL PRIVILEGES ON *.* TO 'theuser'@'localhost' 
    GRANT ALL PRIVILEGES ON *.* TO 'theuser'@'localhost' 
    CREATE USER 'theuser'@'%' IDENTIFIED BY '[your_pwd]' 
    GRANT ALL PRIVILEGES ON *.* TO 'theuser'@'%' WITH GRANT OPTION 
    
  2. Next, from the AWS Management Console find the Security Group that you assigned to your instance during set-up and add 'MySQL' to the group. You can also manually add port 3306. Save and whoala ready to go!