Tuesday, July 31, 2012
port forwarding in router
Port
Forwarding
Step1:
open the router page with ip address 192.168.1.1 , it will open the
page and ask for username and password .submit username and password
and press enter.
Step2:
in the left hand side some options are there , in that options click
on “Forwarding” ---in that select “Virtual servers” and click
on “Add New” option.
Step3:
Then it asks to fill some details like serviceport, ipaddress,
protocol, status, just fill the details.
- Service port= application that run on which port.
- IP address=IP address of server
- Protocol=All
- Status=Enabled
And click on “save”
Step4:
checking for the application is accessible from any where in the
internet.
For accessing the application you must
know the External IP address of the router. So to know the External
IP of router just type www.cmyip.com
in the browser. It shows the IP of router.
Step5:
Then type the IP of router with port number of the application in the
browser of remote pc(any pc which is connected to internet). Then it
redirects to the application which is in following screenshot.
“192.168.x.y:5000”---like this
type in the browser.
squid proxy server
setup squid proxy server
proxy server is used to block the sites in the office, to set up the normal proxy server you can follow the procedure below
proxy server is used to block the sites in the office, to set up the normal proxy server you can follow the procedure below
To
install squid proxy server
#apt-get
install squid
To
view the status of squid
#service
squid status
In
this /etc/init.d/squid restart will not work so to start and stop the
services
#service
squid stop
#service
squid start
To
go to the configuration file
# cd
/etc/squid
#ls
Here
you will see squid.conf then make a copy of it so that it can be used
after testing it
#cp
squid.conf squid.conf.bak
To
view the configuration file
#gedit
/etc/squid/squid.conf &
then
in the configuration file go assigin line no
then
go to the line number around 3400. ther you will find something like
Tag:
visible_hostname
at
the bottom you type
visible_hostname
sunnyproxyserver
then
save
Then
stop and start the service
#service
squid stop
#service
squid start
then
give
Then
to firefox for editing the firefox with system ip and http port no
first
go to firefox -> edit -> prefernces -> advanced ->
network -> then go to configuration of firefox connect to internet
-> manual proxy config
HTTP
192.168.x.x port: 3128
then
press ok
Then
go to firefox and type any site then it will proxy is annoyoing to
connect sunnyproxyserver
Then
to configuration file
#gedit
/etc/squid/squid.conf &
then
go to line no aroun 600 you will find
#http_access
allow localnet
then
here uncomment the #
Then
stop and start the service
#
service squid stop
#
service squid start
Then
go to firefox and type any website it will open
Then
again go to configuration file
# gedit
/etc/squid/squid.conf &
go
to line nop which we uncommented last
http_access
allow localnet
here
edit it as deny
like
this
http_access
deny localnet
Then
stop and start the services
#service
squid stop
#service
squid start
then
go to fire fox type any website it will be blocked as proxy
connection sunnyproxyserver
Then
go to configuration file again change the
http_access
deny localnet
to
#http_acess
allow alocalnet
if
you want to block some websites then apply acl
then
in configuration file around 630
you
will find
TAG:http_access
there
edit the configuration file at the bottom of it type
acl
block_websites dstdomain .msn.com .espn.com
http_acces
deny block_websites
then
save
then
stop and start the service
#service
squid stop
#service
squid start
then
go to the browser nad type msn.com and espn.com it will not opened
due to annoying of the proxy server
the
see weather other sites are opening or not
Friday, July 27, 2012
script for the s3 buckets backup
Script for the amazon s3 backup by s3cmd
This is the script for the amazon s3 bucket backup in the s3 bucket with the name and date, to do flow this page and write the script below
#vim s3cmd.sh
1 #!/bin/bash
2
3
4
5 ##Notification email address
6
7 _EMAIL=xyz@xyz.com
8
9
10
11 ERRORLOG=/var/log/backuplogs/backup.err`date +%F`
12
13 ACTIVITYLOG=/var/log/backuplogs/activity.log`date +%F`
14
15
16
17 ##Directory which needs to be backed in s3 bucket
18
19 SOURCE=/root/Desktop/lotos3/
20
21
22
23 ##Name of the backup in bucket to be stored with date and time
24
25 DESTINATION=`date +%F`
26
27
28
29 ##Backup degree(this is for to maintain how many backup and delete the old)
30
31 DEGREE=7
32
33
34
35 #Clear the logs if the script is executed second time
36
37 :> ${ERRORLOG}
38
39 :> ${ACTIVITYLOG}
40
41
42
43 ##Uploading the daily backup to Amazon s3
44
45 /usr/bin/s3cmd -r put ${SOURCE} s3://MClouds-757cf3e2e4/${DESTINATION}/ 1>>${ACTIVITYLOG} 2>>${ERRORLOG}
46
47 ret2=$?
48
49
50
51 ##Sent email alert
52
53 msg="BACKUP NOTIFICATION ALERT FROM `hostname`"
54
55
56
57 if [ $ret2 -eq 0 ];then
58
59 msg1="Amazon s3 Backup Uploaded Successfully"
60
61 else
62
63 msg1="Amazon s3 Backup Failed!!\n Check ${ERRORLOG} for more details"
64
65 fi
66
67 echo -e "$msg1"|mail -s "$msg" ${_EMAIL}
68
69
70
71 #######################
72
73 ##Deleting backup's older than DEGREE days
74
75 ## Delete from both server and amazon
76
77 #######################
78
79 DELETENAME=$(date --date="${DEGREE} days ago" +%F)
80
81
82
83 /usr/bin/s3cmd -r --force del s3://MClouds-757cf3e2e4/${DELETENAME} 1>>${ACTIVITYLOG} 2>>${ERRORLOG}
84
85
Cronjobs:
Daily Backup with 7 days retention:It takes daily full backup
35 10 * * * /root/s3cmdbackup.sh
Monthly Backup: It takes a full backup every month 15th and 28th dates
40 2 15,28 * * /root/s3cmdbackup.sh
Yearly backup: It takes a full backup every year december 31st
20 23 31 12 * /root/s3cmdbackup.sh
This is the script for the amazon s3 bucket backup in the s3 bucket with the name and date, to do flow this page and write the script below
#vim s3cmd.sh
1 #!/bin/bash
2
3
4
5 ##Notification email address
6
7 _EMAIL=xyz@xyz.com
8
9
10
11 ERRORLOG=/var/log/backuplogs/backup.err`date +%F`
12
13 ACTIVITYLOG=/var/log/backuplogs/activity.log`date +%F`
14
15
16
17 ##Directory which needs to be backed in s3 bucket
18
19 SOURCE=/root/Desktop/lotos3/
20
21
22
23 ##Name of the backup in bucket to be stored with date and time
24
25 DESTINATION=`date +%F`
26
27
28
29 ##Backup degree(this is for to maintain how many backup and delete the old)
30
31 DEGREE=7
32
33
34
35 #Clear the logs if the script is executed second time
36
37 :> ${ERRORLOG}
38
39 :> ${ACTIVITYLOG}
40
41
42
43 ##Uploading the daily backup to Amazon s3
44
45 /usr/bin/s3cmd -r put ${SOURCE} s3://MClouds-757cf3e2e4/${DESTINATION}/ 1>>${ACTIVITYLOG} 2>>${ERRORLOG}
46
47 ret2=$?
48
49
50
51 ##Sent email alert
52
53 msg="BACKUP NOTIFICATION ALERT FROM `hostname`"
54
55
56
57 if [ $ret2 -eq 0 ];then
58
59 msg1="Amazon s3 Backup Uploaded Successfully"
60
61 else
62
63 msg1="Amazon s3 Backup Failed!!\n Check ${ERRORLOG} for more details"
64
65 fi
66
67 echo -e "$msg1"|mail -s "$msg" ${_EMAIL}
68
69
70
71 #######################
72
73 ##Deleting backup's older than DEGREE days
74
75 ## Delete from both server and amazon
76
77 #######################
78
79 DELETENAME=$(date --date="${DEGREE} days ago" +%F)
80
81
82
83 /usr/bin/s3cmd -r --force del s3://MClouds-757cf3e2e4/${DELETENAME} 1>>${ACTIVITYLOG} 2>>${ERRORLOG}
84
85
Cronjobs:
Daily Backup with 7 days retention:It takes daily full backup
35 10 * * * /root/s3cmdbackup.sh
Monthly Backup: It takes a full backup every month 15th and 28th dates
40 2 15,28 * * /root/s3cmdbackup.sh
Yearly backup: It takes a full backup every year december 31st
20 23 31 12 * /root/s3cmdbackup.sh
Wednesday, July 25, 2012
upload and downloads to amazon (s3) bucket
Uploading and
downloading files to amazon (s3) buckets from internet
Now-a-days
some many online storage of data is provided by the many providers
like that amazon is providing online data storage S3 for storage of
the data it can used for upload and downloading the files
in
the cloud and it can be accesed by the public internet. To upload and
download of the files from the any system which is having internet.
For this you have to install the following package.
#
apt-get install -y s3cmd
#
s3cmd
–configure
while
configuring the s3cmd package it will ask for the access id of your
amazon and also the secret key the n select all as ok while
installing
after
this the installation will be completed.
To
see the content of you s3 bucket it will show like this
#s3cmd
ls
here
it will display the files and folders of your s3 bucket some what
like this
s3://Backup_daily
s3://newfolder_weakly
cmd
to check List of s3buckets:#s3cmd ls
List of contents in a Bucket:
#s3cmd ls s3://backups.exleaz.com
Uploading an image or any file/folder to s3 bucket:
#s3cmd -P put /root/Desktop/IMAGE/8.jpg s3://MClouds-757cf3e2e4/
#s3cmd -P put /root/Desktop/myproj.rar s3://MClouds-757cf3e2e4/
#s3cmd -P put /root/Desktop/myproj.rar s3://MClouds-757cf3e2e4/
Deleting an image from the s3bucket:
#s3cmd del s3://MClouds-757cf3e2e4/8.jpg
Downloading an image/file from the s3bucket:
#s3cmd get s3://BUCKET/OBJECT LOCAL_FILE
#s3cmd get s3://MClouds-757cf3e2e4/8.jpg /root/Desktop/myproj/
syncing a bucket to a local folder:
#s3cmd sync s3://MClouds-757cf3e2e4 /root/Desktop/s3tolo/
Tuesday, July 24, 2012
send mails from the command prompt
send mails from command prompt
if you would like to send the mails from command prompt, then you have to install this setup in your local systems and servers also
if you would like to send the mails from command prompt, then you have to install this setup in your local systems and servers also
#apt-get
install heirloom-mailx
#apt-get
install mailutils
#apt-get
install ssmtp
Edit the configuration file as shown below
#vim
/etc/ssmtp/ssmtp.conf
comment all the lines in the file then after enter the below data
root=yourmailid@gmail.com.com
mailhub=smtp.gmail.com:25
hostname=sandeep
AuthUser=youremailid@gmail.com
AuthPass=********* (password of the mail id account)
UseSTARTTLS=yes
UseTLS=yes
FromLineOverride=YES
:wq!
Then go to the configuration file from which account you would like send the mails
#vim
/etc/ssmtp/revaliases
root:yourmailid@gmail.com:smtp.exleaz.com:25
:wq
Then in this configuration file give your account name
#vim
/var/mail/account_name
root
:wq
after this test by sending a mail like this
#echo "hi how are you" | mail -s 'test' maild id which you want to send the mail
then the meaasge will be delivered to your account
cron in ubuntu
How
to write cron in ubuntu
cron
is use to perform we repetable jobs which is done in system each and
every second or minute
when
we install ubuntu it will come defaultly
sudo
yum install vixie-cron crontabs
#chkconfig crond on
#chkconfig crond on
#/service
crond start
for
suppose you would like to perform a command like example each every
minute then you can do like this
it
is in the below format
minutes
hours (date of month) (month) (day of the weak) command
16
9 * * * chmod -R 777 /var/managment/*
here
in the above we had given as every morning at 9hours 16minutes on
every day every month this command will be executed
for
suppose you would like to perform it for every 10 minutes means here
it will be like this
*/10 * * * *
chmod -R 777 /var/managment/*
so
here the will will be runned for every 10 minutes,
if
would like to run for every minute means then do like this
* * *
* * chmod -R 777 /var/managment/*
so
here the command will be runned for every minute
To
check the cron running in your system then type like this
#crontab
-l
to
restart the cron then
#service
crontab restart
Monday, July 23, 2012
Thunderbird installation in ubuntu
How
to user thunderbird in ubuntu
Thunderbird
is used to open your mail accounts of different providers,
thunderbird is simple and esy to use then other mails
To
install the thunderbird download the thunderbird from here
Then
install the .tar.gz package by extracting and installing it
after installing you will get like this
here add your name and your mail id and password so that your mail acoount will be be added and oppened. (please do select the option of imap so that you cant lost your mails).
then after this you click on ok. then your account will be added. yiou can see your inbox outbox and drafted mails in thunderbird.
here your account will be created. if you want to attach the singnature file
here click the attach the singnature file option and click on the choose button to add the existing singnature file
ruby and rails installation on ubuntu
Installation
of ruby and rails in ubuntu
to
install ruby and rails in ubuntu 10.10 follow the procedure for the
installation of ruby & rails
to
install ruby
#apt-get
install ruby-full
after
this the ruby will be installed
then
after this for download the ruby gems
#wget
production.cf.rubygems.org/rubygems/rubygems-1.3.7.tgz
after
this the rubygems will be downloaded as a .tar file then extract the
the downloaded file
#tar-xvf
rubygems-1.3.7.tgz
after
this move to th rubygem directory
#cd
rubygems-1.3.7/
after
this install the rubygems
#ruby
setup.rb
here
the ruby gem will be installed
create
link file the gems
#ln
-s /usr/bin/gem1.8 /usr/bin/gem
then
insall gem like this
#gem
install rdoc
for
the installation of rails 2.3.8 version of rails
#gem
install –version=2.3.8 rails --include-dependencies
after
this the ruby and rails will be installed
after
this install the below package for the installation of mysql gem
#apt-get
install libmysql-ruby libmysqlclient-dev
#gem
install mysql
here
the gem for mysql will be installed
installation of phpmyadmin for lamp in ubuntu
PHPMYADMIN
how
to install php myadmin in ubuntu? Its a simple process to install php
my admin in ubuntu
after
this the installation of phpmyadmin completes
#
sudo
dpkg-reconfigure -plow phpmyadmin
after
this create a link file between phpmyadmin and apache2 (installation
depends on the earlier post)
if
you install lamp it will be reflected like this
#sudo
ln -s /etc/phpmyadmin/apache.conf /etc/apache2/conf.d/phpmyadmin.conf
after
this a link file will be created between myadmin and apache
then
restart the server
#
sudo /etc/init.d/apache2 restart
after
this go to browser and type like http://localhost/phpmyadmin
installation of lamp in ubuntu
Lamp
server
Installation
of lamp is same as xammp but the only difference is we use linux in
the place of the windows
lamp
can be installed in ubuntu. if we install the lamp server we will get mysql, php, linux
#sudo
apt-get install lamp-server^
here
the (^) is important because it will be installed only if we use ^
.so don't miss this symbol (^)
after
this the lamp will be installed
after
this will ask for the mysql root password for the creation of the
database
after
this it will be completed
to
test your apache server go to the browser and type this
http://localhost
then
it will be opened like “it works” so by this you can confrim that
the apache working
then
to test you php do like this
#sudo
nano /var/www/testing.php
here
a file will be created then edit this file as follows
<?php
phpinfo(); ?>
then
save the file
then
restart the apache server
#sudo
/etc/init.d/apache2 restart
after
the installation go to the browser and type
http://localhost/testing.php
then
it will be resloved as a page in the browser
after
the installationof lamp checxk for the bind address
# cat
/etc/hosts | grep localhost
here
it will show the local hosts
#cat
/etc/mysql/my.cnf | grep bind-address
in
the configuration file file you can see the bind address as
127.0.0.1. it will be as default if not means cange the bind address
of the my.cnf file
Friday, July 20, 2012
why to upgrade server from small to medium in amazon
Upgradation
of servers from m1.small to m1.medium or large instances :
We
are using the small instance. But it is not capable to run more apps.
It is capable to run upto 15 to 20 apps. So we have to upgrade the
hardware of small instance. So after small instances there is medium
instances are there. So we have to upgrade m1.small to m1.medium
instance.
2xm1.small = 1 m1.medium .
so we can deploy up to 40 to 45 apps in medium instance.
Upgradation
:
- If we upgrade from current small instance to medium instance, there is chances to data loss. So avoid data loss first save the entire server as image and save that image in s3 bucket. Then boot the new m1.medium instance from the saved image.
- At the time of saving image we have to stop all the services and then save the image.
- It takes nearly 1 to 2 hours for saving the image. (down time)
- From that image we can boot the new instance.
- New instance having the new ip.
- So After launching the new instance we can make some changes in proxy, firewall, mail relay, name resolution, monitoring and maybe something else, I don't remember-- they need to get the new ip.
- And then shut down the old small instance.
Billing
for medium instance :
Small instance $0.090
Per/Hour
Medium instance $0.180
Per/Hour
For 1 small instance
monthly bill is $64.8 per/month
For 1 medium instance
monthly bill is $129.6 per/month
usb bootable pen drive in windows
USB
BOOTABLE DRIVE
for
quick installation of o.s we would like to go for usb bootable drive
by this we can save buying a dvd
here
down we'll show to create a usb drive with windows 7, for this you
require 4gb pendrive or more than that and windows 7 cd which is
genuine
- in windows 7 go to start button in acces Click Start -> All Programs -> Accessories and right-click on Command Prompt and run it as administrator then in the command promot type like thisDISKPART
- Then afteer type like thisLIST DISK
- Then after you can see disk 0 and disk 1 in the bottomthen type like this one after the other you will get like thisSELECT DISK 1CLEANCREATE PARTITION PRIMARYSELECT PARTITION 1ACTIVEFORMAT FS=NTFSASSIGNEXIT
- after this the formatting of the pendrive will take about 30 mintues, sfter this open the mycomputer you will find the pendrive as the F: drive and the cd inserted in the cd tray will be as E: drive then after this type the command as below
E:/BOOT/BOOTSECT.EXE /NT60 F:
Successfully installed NFTS file system bootcode
after this you insert the windows 7 cd in the cd drivethen open the the cd and copy all the files into the pendrivethis will takle time after this your pen drive will be ready to use as a usb bootable drive
Tuesday, July 10, 2012
creating and appending files in ubuntu
How to
create files in ubuntu, and view the content of files using editors
there are
different types of editors in ubuntu, you can use nano, vi, vim these
editors to view the content of the file
to install
vim do like this
#apt-get
install vim
then this
will be installed
- to create an empty file#touch sunnyhere an empty file will be created with 0 bytes
- to create a file with some matter in it#cat > momhi mom how are youthen ctrl+d to save
- to view the connect of the file# cat momhi mom how are you
- to append the matter in already present file# cat >> momhi mom how are youhi mom this is your sonctrl+d to save
- to view the content you can use these#vim momafter this to save w!To save and quit wqTo save and quit forcefully wq!To quit forcefully q!and other like this#vi momand also can use#nano momhere click x to saveand Y for yes
how to log into root account in ubuntu after installing
how to log into root account in ubuntu after installing
after installation of the ubuntu you are asked to log in as root for this you do like this
when you install ubuntu with a user name then do like this
# sudo passwd root
after this you will ask for the normal user password and then
you will promtted with the new password then create the password after this you log in to root
like this
# su root
here give the new password for the root
then you can log in as root
after installation of the ubuntu you are asked to log in as root for this you do like this
when you install ubuntu with a user name then do like this
# sudo passwd root
after this you will ask for the normal user password and then
you will promtted with the new password then create the password after this you log in to root
like this
# su root
here give the new password for the root
then you can log in as root
Subscribe to:
Posts (Atom)