Help - Search - Members - Calendar
Full Version: HOW-TO: install LFTP and move sites from one server to another
The Planet Forums > System Administration > HOWTOs
Pages: 1, 2
jaume
Here it goes again:

Download and install into your server LFTP and is easy to move content:
http://freshmeat.net/projects/lftp
http://lftp.yar.ru/
-----------------------------
HOW-TO install LFTP.. just following the LFTP install instructions:
1. su -
2. mkdir /home/admin/lftp
3. cd /home/admin/lftp
4. wget http://ftp.yars.free.net/pub/software/unix...p-2.6.12.tar.gz
5. tar xzfv lftp-2.6.12.tar.gz
6. cd lftp*
7. ./configure
8. make
9. make check
10. make install
11. make clean
--------------------------

How to move a site?

Suppose I have created a site in my Ensim Box and this is the public html dir:
/home/virtual/mydomain.com/var/www/html
and the site I want to move is in another server anywhere
Ex: in my loved Raq3 /home/sites/site1/web

Make sure the target directory is empty (to get an exact mirror from the other:)).

1. cd /home/virtual/mydomain.com/var/www/html
2. login to your raq using LFTP:
lftp -u raq3_ftp_user ftp.myraq3.com
3. cd /home/sites/site1/web
3. then just type :
mirror
4. Enjoy
5. exit

All the content from the /home/sites/site1/web dir in the raq has gone to the /home/virtual/mydomain.com/var/www/html dir in my Ensim

Then you only have to chown all files to the correct user:
Ex: for site1:
cd /home/virtual/site1/fst/var/www/html
chown -R admin1.admin1

Also remember to chmod files if necessary (if you have scripts that need to write to those files).

**********************************************

I have moved using this method HUGE sites ( more than 8 gig's ) whithout any problem.

Also this method is a lot faster than having to make tarballs to move sites.
Powerlord
ncftp can also move multiple files at a time. ncftp comes preinstalled on Redhat machines.

To login to an ftp using ncftp:
ncftp -u username sitename.com

To get a directory and all its subdirectories:
get -R directoryname

Note: This *has* to be a directoryname and not * or else it doesn't work. I ended up having to (assuming that I'm already in the local website directory):
ncftp -u powerlord sitename.com
********** (password)
ncftp /home/sites/home/users/powerlord > cd ..
ncftp /home/sites/home/users > cd ..
ncftp /home/sites/home > get -R web
(information on files transferring)
exit
no (to question about saving a bookmark)
cd web
mv * ../
cd ..
rmdir web
markymark
I'm not sure what happened to the original URL for LFTP, but it is now:
ftp://ftp.yars.free.net/lftp/lftp-2.5.2.tar.gz
(a new version too)
jaume
QUOTE
Originally posted by markymark
I'm not sure what happened to the original URL for LFTP, but it is now:
ftp://ftp.yars.free.net/lftp/lftp-2.5.2.tar.gz  
(a new version too)

Yep.. new version out.. Just edited and updated the POST icon_smile.gif
Paul_77
I have tried what you said but once I get to ./configure it give back error saying:

error: newly configured file is older than distributed files!
Check your system clock

How do I fix this? Sorry for my newbieness icon_smile.gif
markymark
After doing this, I am having problems with permissions. I can't overwrite a file (say index.html) in /var/www/html, so I have to delete it then upload my file. And I can't upload at all in subdirectories. Is there a way I can chmod whole site directories at a time to fix this problem, because I used lftp for a bunch of sites.
markymark
Oops, after quite a bit of searching I found this thread:
http://forum.rackshack.net/showthread.php?...highlight=chmod

I didn't try it yet, but I thought you might wanna add this to your HOW TO, it must be a problem everyone doing this would have?
jaume
Edited but the problem with chmodding will only happen if you need files chmodded other than default to allow scripts to write to them so this is a site specific issue:).
Fallout2man
The Chown command by default gives me a too few arguments error, after adding a wildcard where the filename should be it gives me an invalid user error, what's going on here?



Edit : NM, Mouse showed me how to do it right.
jaume
try this:

(# = number of the site.)

cd /home/virtual/site#/fst/var/www
chown -R admin#.admin# html
ebay-nut
Yet another new version,

here's the new link

CODE
wget [url]ftp://ftp.yars.free.net/lftp/lftp-2.5.4.tar.gz[/url]


Nice HOW-TO jaume! very useful!
LighthousePoint
what happended to the old-fashined, "just tar everything up" strategy?
jaume
I't up to your choice to use one method or another but this one is really simple and faster.
splicesite
holy guacamole, LFTP is mindbogglingly fast. wow
perldork
Do you guys tunnel it over SSL? I would think that scp with compression on and a tar file would be a better way to go for this ... either a tar file or with -r .. due to the added security and, I would think, reduced bandwidth usage ...

scp -r /home/virtual/foo user2@machine2.com:/home/virtual/foo

Are you all using SSL and some kind of compression? just curious.
perldork
Looks cool .. just downloaded it .. you can also install this in one step as root icon_smile.gif ..

rpm -ivh http://ftp.yars.free.net/lftp/binaries/lft....6.2-1.i386.rpm

I don't understand what ftps is using .. it is just ftp over SSL? I was hoping it was sftp (ftp over SSH) but it isn't.

Nice utility!
s9jeremiah
I found this to be the best Christmas present I have received so far!!! icon_razz.gif

Merry Christmas!
Syan
instead of moving the files through lftp, is it possible just to send over a copy of the files?
jaume
QUOTE
Originally posted by Syan
instead of moving the files through lftp, is it possible just to send over a copy of the files?

Is what it does. Is mirroring. The original files remain in the source server.
oknext
What about moving email, etc. ... that possible too?
Rene
I have 1 server with it's own dns (ns1 and ns2.domain.com) and I need 2 domains transferred to my 2nd server (ns3 and ns4.domain.com)

The domains are pointed to my first ns's (ns1 and ns2) but i need those domains fully operating on my 2nd server, that is all email and stuff too. How would I manage to do that ?

Any help greatly appreciated.

P.S. The Best wishes and a happy new year for everyone.
oknext
Is there anyway to transfer all the user into too?

Some sites have 100+ users and that would be a pain manually. icon_sad.gif


Thanks in advance... RB
Stormdancing
New version

ftp://lftp.yar.ru/lftp/lftp-2.6.4.tar.gz
freddo
Why not just use the RPM...

http://ftp.yars.free.net/lftp/binaries/lft....6.4-1.i386.rpm
Stormdancing
oops
Hi Freddo
Just another Newbie blindly following How To Instructions to a T.

Didn't see perldorks post about the rpm
Dangit!

Thanks, you made me blink
gummyAvenger
newbie here, so bear with me icon_smile.gif

I followed the instuctions (but I used this one instead: ftp://lftp.yar.ru/lftp/lftp-2.6.4.tar.gz). when I did ./configure and make, etc, it did a bunch of stuff, but when I type
lftp -u username ftpsite
it says "bash: lftp: command not found"
it says the same thing if I just type
lftp

...any ideas as to what I'm doing wrong?

Thanks for your time and patience.

-Daniel

[edit]
nevermind... I followed this tutorial:
http://forum.rackshack.net/showthread.php?...&threadid=16859
and now it works
[/edit]
sushil2000
ncftp should already be installed as mentioned in an earlier response.

Below is a simple one-liner:
CODE
ncftpget -R -u username -p password ftp.remote-host.com /path/to/local/folder /path/to/remote/folder

Using the -u and -p options are not recommended, because your account information is exposed to anyone who can see your shell script or your process information.

see 'man ncftpget' for more info on security and use the -f option instead to specify a file with the account information, changing the permissions of the file so no-one else can read it.

Use the -b option to run in the background.
Luciffer
Thank you thank you thank you .. jaume

You just helped me transfer 80GBs!!!

One note.. if you have a large site... with lots of files.. you are better off Tarring it up and then using LFTP... went almost 50X faster for me.. LFTP transfers large files a LOT faster than small ones it has to do one at a time. (I got 1.7MBs/sec for my 5-8GB tars) (and server that I was transferring to was outside RS)
Syan
is rsync faster then Lftp, i use rsync everyday to transfer GIG's of movie files from one server to a few other since i have roundrobing setup for loadshare.... does anyone has a better and faster solution? i currently run cron jobs to execute rsync every once in a while to initiate the transfers.
unclstevel
Thanks so much! This lftp program works like a charm. Thanks for contributing the tutorial. I am currently moving one of my sites which is over 22 gigs and it's going fast as heck. This just saved me loads of time!

Thanks again,
Steve
drmike
Is there any method of using the mirror function in the background?

-drmike

(I don't want to stay on line here for 6-7 hours doing this moving a site over a slow link sitting at Kinko's at 20cents a minute.)
jaume
QUOTE
Originally posted by drmike
Is there any method of using the mirror function in the background?

-drmike

(I don't want to stay on line here for 6-7 hours doing this moving a site over a slow link sitting at Kinko's at 20cents a minute.)


Yes there's a way using a script:

LFTP script :
CODE
open -u username,password ftp.domain.com

cd /path/to/directory/we/want/to/mirror

mirror

exit


Save as lftp_remote_server_action and chmod 0755

Now cd to the target directory where you want to mirror:

cd /path/to/dir/where/to/mirror

and do

lftp -f /path/to/lftp_remote_server_action &

BTW: be careful with the mirror function .. make sure you are in the proper dirs before executing:)
drmike
thank you. works fine.

-drmike
kinglear
is this backup including database bacup?
REBIS
Anyone currently running this on Ensim Pro? It apparently requires conflicting Glibc ver. :confused:
drmike
QUOTE
Originally posted by REBIS
Anyone currently running this on Ensim Pro? It apparently requires conflicting Glibc ver. :confused:


you mean lftp? Installed fine here but I've upgraded glibc earlier. There's a howto on how to do it. Fairly simple, you just have to get all the files though.

-drmike
REBIS
Hey Doc,

Yes, but current lftp-2.6.5 requires Glibc ver which conflicts with RH7.3 if I'm not mistaken.

Reb
drmike
QUOTE
Originally posted by REBIS
Hey Doc,

Yes, but current lftp-2.6.5 requires Glibc ver which conflicts with RH7.3 if I'm not mistaken.  

Reb


try using an older verson of lftp then. do a search on rpmfind and download that verson.

-drmike
Aidden
I have installed 2.6.6 on Ensim pro with no errors and its working great.
lizardthefish
Hello.

I followed instructions to a T. And all seems in order except that when I attempt to log in to the other server here is what I get:


root@me [/home/site1/webpub]# lftp -u username othersite.com

Password: ********

lftp username@othersite.com:~> cd webpub

cd: Login failed: 530 Login incorrect.

lftp username@othersite.com:~>



I have the right login and password combo for the other machine. I tested it with another ftp app. I can't get lftp to log in after many tries.

I don't have root permissions on the machine I wish to transfer files from. Is there a chance that I need to be logging in to the offsite machine as root to use LFTP? Or maybe another reason like that?

Thanks for any help.
Sc
REBIS
QUOTE
Originally posted by Aidden
I have installed 2.6.6 on Ensim pro with no errors and its working great.


Did you have to upgrade Glibc?
REBIS
QUOTE
Originally posted by kinglear
is this backup including database bacup?


Not backup...file transfer (L-FTP).
ledjon
scp (with -r and -p) or rsync are your best options, as they preserve file permissions (which can be a pain to redo)

scp is going to be slower then rsync (about the speed of ftp). scp is somewhat-slow because it encrypts the file before it sends it over the wire (as is the nature of the ssh protocols). rsync can be faster then all of the above options mentioned in this thread because, 1) it doesn't use the ftp-style port-open-and-wait-for-file-data method to transfer files, and 2) you can have it compress/uncompress the data on the fly (-z flag), which obviously saves time transferring. It is also smart enough, by default, to know not to compress files that wont compress well (such as already compressed files), so you wont waste cpu cycles on them.

rsync also requires you to setup an entry in the rsync.conf file (which isn't too bad, but can be a pain if you have to transfer 100 sites, one at a time... unless you move them all as one rsync repository, then split them up as needed)

Just my thoughts.

P.S. Oh yeah, and if you're wanting to use ftp mirroring still, wget can do this for you, and it is installed on *every* redhat system since the 6.x days (so no need to mess with installing it). It will also keep the modification times if it is able to retrieve them from the server (which rsync does too, of course)
Yuji
I followed the instraction of How-TO install LFTP, exactly step 1 to 11 and successed.
after11,
lftp can't be found.

[admin@ns02 admin]$ which lftp
/usr/bin/which: no lftp in (/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11R6/bin:/home/admin/bin)
jaume
QUOTE
Originally posted by Yuji
I followed the instraction of How-TO install LFTP, exactly step 1 to 11 and successed.
after11,
lftp can't be found.

[admin@ns02 admin]$ which lftp
/usr/bin/which: no lftp in (/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11R6/bin:/home/admin/bin)


LFTP should be installed in /usr/local/bin/lftp

Add /usr/local/bin to your user path or use the full path to execute it.
Maysa
Thanks! :-)
lizardthefish
QUOTE
Originally posted by lizardthefish
I don't have root permissions on the machine I wish to transfer files from. Is there a chance that I need to be logging in to the offsite machine as root to use LFTP? Or maybe another reason like that?


Any help here anyone? Should I be able to use this without admin permissions on the other machine?

If I must use rsync, does anyone know of a HOWTO on it? I can't seem to find anything. Or even where to download it.

Thanks:confused:
jaume
QUOTE
Originally posted by lizardthefish
Any help here anyone? Should I be able to use this without admin permissions on the other machine?

If I must use rsync, does anyone know of a HOWTO on it? I can't seem to find anything. Or even where to download it.

Thanks:confused:


You don't have to install nothing in the remote machine so noadmin rights needed ... you just need login info to get into remote ftp. LFTP is just an advanced FTP client.
lizardthefish
QUOTE
Originally posted by lizardthefish
when I attempt to log in to the other server here is what I get:


root@me [/home/site1/webpub]# lftp -u username othersite.com

Password: ********

lftp username@othersite.com:~> cd webpub          

cd: Login failed: 530 Login incorrect.

lftp username@othersite.com:~>  



I have the right login and password combo for the other machine. I tested it with another ftp app. I can't get lftp to log in after many tries.



Sorry to press this issue but it doesn't make any sense to me. Does the above command line dialogue fit with what you know and does it indicate to you what the problem might be?
Yuji
QUOTE
Originally posted by jaume
LFTP should be installed in /usr/local/bin/lftp

Add /usr/local/bin to your user path or use the full path to execute it.


It works fine. Thank you.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.