THE IT IDEAS

  • Home

Tuesday, 31 March 2015

Create new user in AWS EC2

 THE IT IDEAS     17:02     EC2   

Create new user in AWS EC2

First of all user in your Instance
#sudo su
#adduser theitideas   <-- keep password with you to fire command with sudo

Login with new user
#su theitideas

Generate private and public key for new user.
#ssh-keygen -t rsa
#cd /home/theitideas/.ssh/
#touch authorized_keys
#cat id_rsa.pub > authorized_keys

#exit
Make entry to your to access command with sudo in visudo file
#visudo  <-- once this file open find "Allow members of group sudo to execute any command" and enter below mentioned line in that file then save and close.

theitideas ALL=(ALL:ALL) ALL

Provide below permissios 

#chmod go-w /home/theitideas
#chmod 700 /home/theitideas/.ssh
#chmod 600 /home/theitideas/.ssh/authorized_keys

Now copy or download private (id_rsa)key from server to your local machine to login.
#cat id_rsa

All done now you can login with your private key (id_rsa) like below from your machine.

#ssh -i id_rsa theitideas@12.34.45.56

Hurray !!!! :)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Tuesday, 16 December 2014

How to resolve mcrypt extension missing error.

 THE IT IDEAS     14:46     error   

Error Message
"The mcrypt extension is missing. Please check your PHP configuration"

#apt-get install php5-mcrypt
#ln -s /etc/php5/conf.d/mcrypt.ini /etc/php5/mods-available    or    If this command not work fire below one for latest apache.
#ln -s /etc/php5/mods-available/mcrypt.ini /etc/php5/mods-available/
#php5enmod mcrypt
#service apache2 restart

Reload and check error message gone.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

How to upload EC2 Data to S3 Bucket with s3cmd

 THE IT IDEAS     14:36     aws   

Install s3cmd third party software in EC2 Instance.

#apt-get install s3cmd
Configure s3cmd to access your S3 Bucket with below prodecure.

#s3cmd --configure


Enter new values or accept defaults in brackets with Enter.
Refer to user manual for detailed description of all options.

Access key and Secret key are your identifiers for Amazon S3
Access Key : PASTE YOUR ACCESS KEY
Secret Key : PASTE YOUR SECRET KEY

Encryption password is used to protect your files from reading
by unauthorized persons while in transfer to S3
Encryption password:    ENTER
Path to GPG program [/usr/bin/gpg]:    ENTER

When using secure HTTPS protocol all communication with Amazon S3
servers is protected from 3rd party eavesdropping. This method is
slower than plain HTTP and can't be used if you're behind a proxy
Use HTTPS protocol [No]:   ENTER

On some networks all internet access must go through a HTTP proxy.
Try setting it here if you can't conect to S3 directly
HTTP Proxy server name:     If your your are using internet proxy to connect internet provide details here or just press ENTER

New settings:
  Access Key: YOUR ACCESS KEY
  Secret Key: YOUR SERCET KEY
  Encryption password:
  Path to GPG program: /usr/bin/gpg
  Use HTTPS protocol: False
  HTTP Proxy server name:
  HTTP Proxy server port: 0

Test access with supplied credentials? [Y/n] Y
Please wait, attempting to list all buckets...
Success. Your access key and secret key worked fine :-)

Now verifying that encryption works...
Not configured. Never mind.

Save settings? [y/N] y
Configuration saved to '/root/.s3cfg'

s3cmd Setup is completed.

#s3cmd ls             <--- This command will show your Buckets in your account.
2014-12-16 08:33  s3://bucketwork


<---     Now setup your Source folder and Destination S3 Bucket.      --->

#s3cmd sync /home/ubuntu/backup/ s3://bucketwork/
WARNING: Redirected to: bucketwork.s3-ap-southeast-1.amazonaws.com
WARNING: Module python-magic is not available. Guessing MIME types based on file extensions.
/home/ubuntu/backup/2014-12-16/mysql.gz -> s3://bucketwork/2014-12-16/mysql.gz  [1 of 1]
 375 of 375   100% in    0s     5.43 kB/s  done
Done. Uploaded 375 bytes in 0.1 seconds, 5.19 kB/s


Its Done you can set this command as Cron to run whenever you need.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Friday, 12 December 2014

How to move github local folder to another location.

 THE IT IDEAS     11:12     github   

Open your GitHub Clone folder and move ".git" folder to your destination folder.

Eg. Clone folder :: /var/www/html/htmwebsite
      Destination folder :: /var/www/html

#cd /var/www/html/htmlwebsite
#mv .git ../        or     mv .git /var/www/html

Then you can move your all files and folder from htmlwebsite to destination folder

#cd /var/www/html/htmlwebsite
#mv * ../           or     mv * /var/www/html

Thats It !! Now run status command to check git is recognise your destination folder or not.

#cd /var/www/html
#git status           <--- If GitHub is recognize folder it will showing message like below ...
On branch master
Your branch is ahead of 'origin/master' by 2 commits.
  (use "git push" to publish your local commits)

nothing to commit, working directory clean



All Done !!!
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Basic GitHub Commands

 THE IT IDEAS     11:09     github   

Clone remote github repository.
#git clone https://github.com/accountnameexample/example.git


After modify files or folder commit your changes on github repository.

#git add filename
#git commit -a     <-- Once you fire this command it will open nano editor to make note of this changes. Just write your note and save the file.

#git push https://github.com/accountnameexample/example.git   <-- This command will upload all your changes to github repo.


To Receive changes from github Repo.
#git pull https://github.com/accountnameexample/example.git     <-- This commnad will receive all changes from github repo to local repo.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Thursday, 11 December 2014

Installation and configuration of GeoIP module in php

 THE IT IDEAS     15:13     geoip, php   

After installation of Apache2 and php follow below step to achive country wise redirection.

#apt-get install libapache2-mod-geoip

Edit geoip.conf file and uncomment mentioned line.
#nano /etc/apache2/mods-available/geoip.conf

<IfModule mod_geoip.c>
  GeoIPEnable On
  GeoIPDBFile /usr/share/GeoIP/GeoIP.dat        <-- uncomment this line with remove # from starting of line.
</IfModule>

save and exit. Once restart apache server

#/etc/init.d/apache2 restart

Now, Make one file to test.

#nano /var/www/html/example.php

Enable mod rewrite module in php

#a2enmod rewrite

Again restart the apache server.

#service apache2 restart

Edit default apache host file and add below mentioned lines before </VirtualHost> tag to redirect url country wise.
#nano /etc/apache2/sites-available/000-default.conf 


<IfModule mod_geoip.c>
GeoIPEnable On
GeoIPDBFile /usr/share/GeoIP/GeoIP.dat
</IfModule>
RewriteEngine on
RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^IN$
RewriteRule . /example.php [L]
RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^DE$
RewriteRule . /2.php [L]
RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^US$
RewriteRule ^(.*)$ http://www.yahoo.com$1 [R,L]
RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^CA$
RewriteRule ^(.*)$ http://www.google.com$1 [R,L]


Save and exit. Once restart apache server.
#service apache2 restart



Brief Information about the lines.

1)  RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^IN$
     RewriteRule . /example.php [L]

Above line will redirect your default page to example.php in your root directory (html folder) If opened with INDIAN IP.

2) RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^DE$
    RewriteRule . /2.php [L]

Above line will redirect your default page to 2.php in your root directory (html folder) If opened with GERMANY IP.

3) RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^US$
    RewriteRule ^(.*)$ http://www.example.co.us$1 [R,L]

Above line will redirect your default page to another URL. If opened with US IP.


4) RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^CA$
    RewriteRule ^(.*)$ http://www.google.com$1 [R,L]

Above line will redirect your default page to another URL. If opened with CANADA IP.



Use your desire setting to achive your goal !!
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Tuesday, 9 December 2014

Install MongoDB php driver in XAMPP/LAMPP

 THE IT IDEAS     15:57     apache2, mongodb   

To install the php driver for MongoDB

Prerequisite ::

#sudo apt-get install autoconf
#export PHP_AUTOCONF=/usr/bin/autoconf
#sudo apt-get install gcc
#sudo apt-get install make

Installing mondodb phpdriver

#sudo /opt/lampp/bin/pecl install mongo
It will download and installing mongo php driver and given message as below


Build process completed successfully
Installing '/opt/lampp/lib/php/extensions/no-debug-non-zts-20131226/mongo.so'
install ok: channel://pecl.php.net/mongo-1.5.8
configuration option "php_ini" is not set to php.ini location
You should add "extension=mongo.so" to php.ini


Now, Just add below mentioned line into php.ini file.

extension=mongo.so

and restart the lampp

#sudo /opt/lampp/lampp restart
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
Newer Posts Older Posts Home

Like Us !!!

Recent Posts

Blog Archive

  • ▼  2016 (1)
    • ▼  April (1)
      • How to Install PHP 7.0, Apache 2.4.18, & MySQL 5.7...
  • ►  2015 (12)
    • ►  August (1)
    • ►  May (2)
    • ►  April (8)
    • ►  March (1)
  • ►  2014 (23)
    • ►  December (8)
    • ►  November (12)
    • ►  April (2)
    • ►  March (1)
  • ►  2013 (7)
    • ►  December (1)
    • ►  April (1)
    • ►  March (1)
    • ►  February (1)
    • ►  January (3)
  • ►  2012 (15)
    • ►  December (6)
    • ►  November (9)

Categories

apache2 EC2 error mysql php ubuntu aws aws rds browser github installation linux mount s3 AWS Bucket CentOS Computer DocumentRoot change How to Benchmarking Webserver IP LAMP Restart Computer SCP command SQL SERVER XRDP administrator amazon rds backup basic commands chat command line disable download drupal ec2.chroot environment external storage device fstab functions geoip gmail google home page iis instance internet java mod rewrite mongodb multiple login network password one password php5 php5-fpm php7 private browsing python repair filesystem repo reset password rhel sa password same computer script sftp share skype ssh tomcat ubuntu 16.04 ubuntu16 visudo windows 8 youtube
JobsMagBlogJobsMag.InThingsGuide

Popular Posts

  • MySQL Basic Commands for Linux
    How to login into mysql prompt For Remote MySQL Server. # [mysql dir]/bin/mysql -h hostname -u root -p   e.g. [mysql dir]/bin/mysql -h...
  • How to make Google Chrome Theme
    Open Google Chrome and open Chrome web store and search my chrome theme Click on Add to Chrome     Click on Add to downloadi...
  • How to run a simple PHP web server
    # php -S localhost:8000 -t /path/to/folder/directory Above command give output like below PHP 5.6.4-4ubuntu6 Development Server started...

Copyright © THE IT IDEAS | Powered by Blogger