Installation of TWiki4 on 1and1 Shared Hosting (Linux)
Pre-Requisites
- SSH client - I use Putty
.
- FTP-Capable Text Editor - I use EditPlus
- 1and1 Shared hosting account - You need to know your 1and1 "root" username, which looks like "u12345678". You can find this out by logging into your account at http://admin.1and1.com
and visiting "Secure Shell (SSH) Access" in the package administration section.
Install TWiki Files
Configure TWiki Installation
TODO Set Up Login Sessions
TODO Install Perl Modules For TWiki
OLD-DO-NOT-USE BryceSchober Installation Steps
- Unzip TWiki-4.0.4.tgz to TWiki-4.0.4
- Unzip contents of hotfix-4.0.4-2.tgz over TWiki-4.0.4
- Rename TWiki-4.0.4 to TWiki-4.0.4-patched
- Execute (cygwin) "tar -cjf twiki-4.0.4-patched.tar.bz2 Twiki-4.0.4-patched"
- Copy twiki-4.0.4-patched.tar.bz2 to remote root
- Execute (remote) "tar -xjf twiki-4.0.4-patched.tar.bz2"
- Rename remote /Twiki-4.0.4-patched to /twiki
- Read http://[your_domain]/twiki/INSTALL.html
- Read http://twiki.org/cgi-bin/view/TWiki/SettingFileAccessRightsLinuxUnix
- Remote "cd twiki"
- Paste script into remote console:
find . -type d -print -exec chmod -v 755 {} \;
find data -name '*.txt' -type f -exec chmod -v 660 {} \;
find data pub -name '*,v' -type f -exec chmod -v 440 {} \;
find lib -name '*.pm' -type f -exec chmod -v 440 {} \;
find locale -type f -exec chmod -v 440 {} \;
find pub -type f -exec chmod -v 660 {} \;
find pub/TWiki/WysiwygPlugin/_kupu -type f -exec chmod -v 440 {} \;
find bin -type f -exec chmod -v 550 {} \;
find bin/logos -type f -exec chmod -v 440 {} \;
find templates -type f -exec chmod -v 440 {} \;
find tools -type f -exec chmod -v 550 {} \;
chmod -v 660 lib/LocalSite.cfg
chmod -v 660 data/.htpasswd
chmod -v 660 data/mime.types
chmod -v 440 bin/LocalLib.cfg.txt
chmod -v 440 bin/.htaccess.txt
chmod -v 440 pub/_work_areas/.htaccess
chmod -v 440 pub/_work_areas/README
chmod -v 440 AUTHORS COPYING COPYRIGHT index.html INSTALL.html LICENSE pub-htaccess.txt readme.txt robots.txt root-htaccess.txt subdir-htaccess.txt TWikiHistory.html twiki_httpd_conf.txt TWikiReleaseNotes04x00.html
chmod -v 550 UpgradeTwiki
- cd ..
- Remote "tar -cjf twiki-20060906-step13.tar.bz2 twiki"
- rename /twiki/bin/.htaccess.txt to /twiki/bin/.htaccess - NOTE: Don't do this, see step 29.
- rename /twiki/bin/LocalLib.cfg.txt to /twiki/bin/LocalLib.cfg
- rename all files in /twiki/bin with no extension, adding .pl extension
- Remote "tar -cjf twiki-20060906-step17.tar.bz2 twiki"
- Download twiki-20060906-step17.tar.bz2 to local root and extract to twiki-20060906-step17
- Modify twiki-20060906-step17/twiki/bin/LocalLib.cfg, $twikiLibPath variable to "//htdocs/twiki/lib"
- Modify first "shebang" line of all .pl files in twiki-20060906-step17/twiki/bin to "#!/usr/bin/perl"
- Execute (cygwin) "tar -cjf twiki-20060906-step21.tar.bz2 twiki" in twiki-20060906-step17/
- Move twiki-20060906-step21.tar.bz2 to local root
- Copy twiki-20060906-step21.tar.bz2 to remote root
- Execute (remote) "tar -xjf twiki-20060906-step21.tar.bz2"
- Modify local twiki-20060906-step17/twiki/root-htaccess.txt , replacing line 13 with:
Redirect /twiki/index.html http://[your_domain]/twiki/bin/view.pl/
- Modify local twiki-20060906-step17/twiki/root-htaccess.txt , inserting following text at line 3:
<Limit GET POST>
order deny,allow
deny from all
allow from [allowed_ip_1]
allow from [allowed_ip_1]
</Limit>
- Rename twiki-20060906-step17/twiki/root-htaccess.txt to twiki-20060906-step17/twiki/.htaccess
- Upload local twiki-20060906-step17/twiki/.htaccess to remote twiki/.htaccess
- Rename /twiki/bin/.htaccess back to /twiki/bin/.htaccess.txt - apparently I wan't supposed to do that!
- View http://[your_domain]/twiki/bin/configure.pl
- View General Path Settings - changed nothing
- Click Next - as per advice in General Path Settings
- Set password to [your_password]
- Return to configuration
- View General Path Settings
- Changed {PubDir}, {TemplateDir}, {DataDir}, and {LocalesDir}, removing extraneous "bin/configure.pl" from middle of path string.
- Save settings, return to configuration
- Changed GenPathSet->{ScriptSuffix} to .pl
- Save settings, return to configuration
- Changed MiscSet->{ReplaceIfEditedAgainWithin} to 0 - NOTE: This ensures that every page save generates a revision
- Save settings, return to configuration
- Created twiki@.com account, username: [your_twiki_email_user] pwd: [your_twiki_email_password]
- Changed Mail->{SMTP}{MAILHOST} to "smtp.1and1.com"
- Changed Mail->{SMTP}{SENDERHOST} to "twiki@[your_domain]"
- Changed Mail->{SMTP}{Username} to "[your_twiki_email_user]"
- Changed Mail->{SMTP}{Password} to "[your_twiki_email_password]"
- Save settings, return to configuration
- Downloaded http://search.cpan.org/CPAN/authors/id/M/MA/MARKSTOS/CGI-Session-4.14.tar.gz
archive for CGI::Session via http://search.cpan.org/search?query=CGI%3A%3ASession&mode=all
, extracted to local root /CPAN_lib
- Downloaded http://search.cpan.org/CPAN/authors/id/G/GB/GBARR/Scalar-List-Utils-1.18.tar.gz
archive for Scalar::Util via http://search.cpan.org/search?query=scalar%3A%3Autil&mode=all
, extracted to local root /CPAN_lib
- Uploaded contents of local CPAN_lib\CGI-Session-4.14\lib directory to remote /twiki/lib/CPAN/lib/
- Uploaded contents of local CPAN_lib\Scalar-List-Utils-1.18\lib directory to remote /twiki/lib/CPAN/lib/
- First successful view of http://[your_domain]/twiki/
- Deleted twiki-20060906-step12.tar.bz2 and TWiki-4.0.4.tar that were mistakenly in remote /twiki - not sure exactly how
- Remote "tar -cjf twiki-20060906-step54.tar.bz2 twiki"
- Set Security->{UseClientSessions} on (was already)
- Set Security->{Sessions}{UseIPMatching} on (was already)
- Changed Security->{LoginManager} to "Twiki::Client::TemplateLogin"
- Set Security->{PasswordManager} to "Twiki::Users::HtPasswdUser" (was already)
- Changed Security->{MinPasswordLength} to 6
- Save settings, return to configuration
- View http://[your_domain]/twiki/
with login / register in sidebar
- Registered user Main.[your_twiki_user_name]
- Received "click to complete" email, confirmed, received confirmation email.
- Logged in successfully.
- Uploaded ".changes", "TestHTMLImport1.txt", and "TestHTMLImport1.txt,v" files from old to new twiki/data/Sandbox
- Viewed http://[your_domain]/twiki/bin/view.pl/Sandbox/TestHTMLImport1
successfully.
- Remote "tar -cjf twiki-20060906-step67.tar.bz2 twiki"
- Made sure all twiki-*.bz2 archives were in local root
- Deleted all twiki-*.bz2 archives and old twiki-something directories
--
Contributors: BryceSchober - 10 Jan 2007
Discussion
Thanks Bryce - this is a great help. Have you tried using the .htaccess templates for the pub and bin folders? Apparently TWiki is quite unsecure without them. I tried using them, but had some problems:
The pub/.htaccess includes a line "php_flag engine off" which breaks the rendering of my TWiki (even though I do have PHP 4 and 5 installed as the comments suggest are necessary for this line).
I also have a problem after creating the bin/.htaccess - the configure.pl becomes inaccessible (pops up a login box, but doesn't accept the login details that work on my site), even though I have edited the .htaccess settings to include my IP address and username.
- Update: Making some progress on this - see my comments in Support/ConfigureAuthentication.
Both issues are not completely cut and dried yet, so could still use some ideas. Of course, these lines can be commented out for now, which still leaves quite a few positive improvements (see my next comment), but for full security, they should be used.
--
EricWoods - 04 Feb 2007
I've noticed that the bin/.htaccess file includes the following lines:
# Use CGI & Perl to handle all files in 'bin' directory, i.e. run as scripts
# - this should remove the need to rename files to end in '.pl' etc,
# if your web hosting provider permits this. Remove if using mod_perl.
SetHandler cgi-script
which mean that you don't have to rename all the files in the bin directory with the .pl extension (I have tried it and it works). So it might be easier to tell people to enable this .htaccess file than it is to get them to 1) rename the files to .pl 2) add the .pl extension to configure 3) change the twiki/.htaccess redirect to go to view.pl... 4) edit about 2 to 4 other settings where it refers to view or register etc.
However, enabling the bin/.htaccess file outright will create more challenges for newbies, as there are quite a few things in there to configure. So maybe just tell them to copy the .htaccess from the parent directory, delete of its contents and just add the line "SetHandler cgi-script"...
--
EricWoods - 04 Feb 2007
I like your suggestions. While you're collaborating on this, check out
HowToInstallCpanModules. I used it to get 4.1 mostly working - but I point it out not for that, but for its method of customizing instructions. That kind of thing could make these directions much easier to follow.
--
BryceSchober - 05 Feb 2007
Cool. I'll check it out after I have sorted out those issues and have something defininte to contirbute. Thanks.
--
EricWoods - 04 Feb 2007
Hi, works with 4.2.0 thanks!
--
GustavoE - 13 Jul 2008
Not working with 4.3.1 yet. I'm stuck with a missing Unicode::String perl module. I'm trying to figure out how to install
CPAN modules locally on 1and1. If I do, I'll post what I learn.
--
KevinMills - 2009-04-30
That dependency slipped into the TWiki-4.3.1 release by mistake. See info at
TWikibug:Item4074
with description how to revert the dependency.
If you want to install
CPAN:Unicode::String
see
HowToInstallCpanModules.
--
PeterThoeny - 2009-05-01
The WYSIWYG editor goofed up the bullets above, restoring...
--
PeterThoeny - 2009-05-01
Thanks a lot for this tutorial !
Here is my installation report : I had an error 500 internal server problem when lauching configure.pl. Whoever, the explanations further in the tutorial (Find-and-replace (in all open files) "#!/usr/bin/perl -wT" with "#!/usr/bin/perl".) solved this problem. I then just had to go back in the tutorial to configure my TWiki.
May I suggest to put this part of the tutorial before the "calling configure.pl" part ? I personnally spent hours in order to solve this problem, thinking that I could not go further in this tutorial before being able to properly configure my TWiki.
--
JeremyGERMAIN - 2011-01-29
Jeremy, this is a wiki, and TWiki is a community-run project. Please
get involved help fix and improve docs.
--
PeterThoeny - 2011-01-29
Bryce Thanks for the information. I just got TWiki-5.1.1 working on my 1and1 hosting account, the basic install. Here are a few additions to these instructions to make TWiki-5.1.1 work.
You should use the bin/.htaccess File. This will allow the script bin files to run without having to rename the files to add the .pl extension as
EricWoods Pointed out. In addition there is another section in the bin/.htaccess to Limit access to the Configure script. You will need to add your IP Address here to allow access to the configure settings. If you do not add your IP you can still access the configure area although you will have to rename the file to `configure.pl` and rename the bin\.htaccess to .htaccess.bak while your configuring the settings and reapply the .htaccess once you've completed with the configuration. It's much easier to add your IP. Go to:
http://www.whatismyip.com
to get your PC IP Address.
# Limit access to configure to specific IP addresses and or users.
# Make sure configure is not open to the general public.
# The configure script is designed for administrators only.
# The script itself and the information it reveals can be abused by
# attackers if not properly protected against public access.
<FilesMatch "configure.*">
SetHandler cgi-script
Order Deny,Allow
Deny from all
Allow from 127.0.0.1, 192.168.1.10
Require user {Administrators}
Satisfy Any
</FilesMatch>
Next up: Once you made the Path changes at `twiki\bin\configure` TWiki View will still fail. There are several paths in the `lib\LocalSite.cfg` file that are not accessible through the configure settings. You will need to edit the `LocalSite.cfg` file in your text editor to correct all the paths. You will have some of the following errors pointed out in topic:
http://twiki.org/cgi-bin/view/Support/Perl5ErrorsTemplateProblem
(see posts by
MichaelDillon and
RonJohnson)
TWiki Installation Error Template "oopsattention" not found. Check the configuration setting for {TemplateDir}.
You want to correct the paths for
{TemplateDir} and
{TemplatePath}. You can search and replace all the `
usr/local/htdocs` and `
/usr/local` paths with your direct path that looks like "
/kunden/homepages/24/d87654321/htdocs/twiki/lib" throughout file `lib\LocalSite.cfg`. Once all the paths are set and cfg file is updated it should work.
--
BillMiller - 2012-07-14
Thanks Bill for sharing this! FYI, it is no longer required to protect the configure script because it is now password protected.
This is a community driven project, feel free to update the how-to instructions above.
--
PeterThoeny - 2012-07-15
Another modification to the bin/.htaccess File. This will prevent the 403, 404, 500 Error page from showing if anyone types in the direct URL to the bin directory. Add this Error Redirect text to the bottom of the bin/.htaccess file.
# Redirect any access bin directory errors to the 'view' script (i.e. Main.WebHome)
# htaccess custom error redirects
ErrorDocument 403 http://yourdomain.tld/twiki/bin/view
ErrorDocument 404 http://yourdomain.tld/twiki/bin/view
ErrorDocument 500 http://yourdomain.tld/twiki/bin/view
--
BillMiller - 2012-09-10