installation1Add my vote for this tag create new tag
, view all tags

Installation of TWiki4 on 1and1 Shared Hosting (Linux)


  • 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

  • Go to DownloadTWiki and copy the url to the latest "full tgz" package.
    • NOTE: TWIki 4.1.0 currently has a bug that keeps the configure script from working. If you don't want to manually apply the simple workaround yourself, stick with version 4.0.5 until there is a patch released. See Bug3476 for details and the workaround.
    • NOTE: TWIki 4.1.0 did not work with 1and1 hosting for me on 2007/01/29 - configure.pl does not render properly. I Either I am doing something wrong, or the original author just assumed 4.1.0 would work. As I have got 4.0.5 working fine, I suspect it was more of an issue with an assumption re: 4.1.0. I did some research, and someone else had the same problem. The developers are making some progress on fixing this, but I could find no info on when this fix would be released.
  • SSH into your 1and1 host. The url is the same as your web domain, but without the "www". So, if your web domain is "www.mydomain.com", you SSH into "mydomain.com". The username is your 1and1 "root" username, which looks something like "u12345678".
  • A few things about Putty:
    • The first time you log in, Putty will probably ask you if you trust the host - go ahead and say yes.
    • In order to paste the contents of the clipboard, right-click anywhere in the console window.
  • At the SSH prompt:
    • Run the unix command
      The resulting string is the "root" directory of your hosted installation, and will be later referred to as [your_root_dir].
    • Enter
      wget [paste the url from above]
      This will fetch the installation package directly to the root of your hosted install.
    • If there is a hotfix patch available at DownloadTWiki, use the wget command to fetch that as well.
    • Create your TWiki's root directory by doing
      mkdir [your_twiki_dir]
      Substitute your preferred name for the twiki root directory, usually just "twiki".
    • Enter your TWiki's root directory by doing
      cd [your_twiki_dir]
    • Extract the twiki archive by doing
      tar -xzf ../TWiki-4.0.5.tgz
      Note that you'll need to change the archive filename to match that which you downloaded.
    • If you are installing a hotfix as well, repeat the previous command with the hotfix archive's file name.
    • Paste into SSH this script:
      find . -type d -print -exec chmod -v 755 {} \;
      find data -name '*.txt' -type f -exec chmod -v 644 {} \;
      find data pub -name '*,v' -type f -exec chmod -v 444 {} \;
      find lib -name '*.pm' -type f -exec chmod -v 444 {} \;
      find locale -type f -exec chmod -v 444 {} \;
      find pub -type f -exec chmod -v 644 {} \;
      find pub/TWiki/KupuContrib -type f -exec chmod -v 444 {} \;
      find bin -type f -exec chmod -v 550 {} \;
      find bin/logos -type f -exec chmod -v 444 {} \;
      find templates -type f -exec chmod -v 444 {} \;
      find tools -type f -exec chmod -v 550 {} \;
      chmod -v 444 lib/LocalSite.cfg
      chmod -v 644 data/.htpasswd
      chmod -v 644 data/mime.types
      chmod -v 444 bin/LocalLib.cfg.txt
      chmod -v 444 bin/.htaccess.txt
      chmod -v 444 pub/_work_areas/.htaccess
      chmod -v 444 pub/_work_areas/README 
      chmod -v 444 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
      This script is a version of a script at SettingFileAccessRightsLinuxUnix that modifies all TWiki files so that they have the recommended permissions.
      For TWiki v4.1.0, some of the file names have changed, so copy the script direct from SettingFileAccessRightsLinuxUnix (but bear in mind 4.1.0 currently fails on 1&1).
    • Execute
      cp root-htaccess.txt .htaccess
      This creates the root access configuration file.
    • Execute
      chmod -v 644 .htaccess
      This enables us to edit the root access configuration file, which we'll do next.
  • In your text editor:
    • Connect to your 1and1 installation via ftp, using your "root" username and password.
    • Open "[your_twiki_dir]/.htaccess".
    • The last line of the file looks something like:
      # Redirect /urlpath/to/twiki/index.html http://your.domain.com/urlpath/to/twiki/bin/view
    • Modify that line, removing the leading "# ", replacing both instances of "urlpath/to/twiki" with [your_twiki_dir], inserting your domain name, and adding a ".pl" to the end of the full url. The result should look something like:
      Redirect /twiki/index.html http://www.[your_1and1_domain]/twiki/bin/view.pl
    • In addition, if you want this twiki to be private (like a company intranet), you'll want to add a section after the first line, which would look like:
      # Sample Root '.htaccess' file
      <Limit GET POST>
      order deny,allow
      deny from all
      allow from [your_company_router_ip]
      allow from [another_allowed_ip]
  • You should now be able to view your remotely hosted TWiki Installation directions at http://www.[your_1and1_domain]/[your_twiki_dir]/INSTALL.html. Now is a good time to read it and learn more about this installation.
  • With SSH, in the /[your_twiki_dir]/bin directory, execute:
    find * -type f ! -name "*.*" | rename 's/(.*)/$1.pl/'
    This will rename all the perl files, adding the ".pl" at the end, which 1and1 requires.
  • Now is also a good time to make a backup of what we've done so far:
    • With SSH, in the ../[your_twiki_dir] directory, execute:
      tar -cjf [your_twiki_dir]-[date-time-stamp].tar.bz2 [your_twiki_dir]
      Substitute the date-time-stamp of your preferred format, in order to distinguish this backup from others in the future, and substitute the name of your TWiki's root directory.
    • It is a good idea to do this operation periodically, and before & after major TWiki administration operations, and to download them to another location for redundancy.

Configure TWiki Installation

  • With SSH, in the /[your_twiki_dir]/bin directory:
    • Execute:
      cp LocalLib.cfg.txt LocalLib.cfg
    • Execute:
      chmod -v 644 LocalLib.cfg
      This enables us to edit the root access configuration file, which we'll do next.
  • In your text editor:
    • Open "[your_twiki_dir]/bin/LocalLib.cfg".
    • Find a line that looks something like:
      $twikiLibPath = "/absolute/path/to/your/lib";
    • Modify that line, replacing "/absolute/path/to/your" with "[your_root_dir]/[your_twiki_dir]". Remember that [your_root_dir] is the output of the "pwd" command, when you're in your root directory (you can get there by "cd ~"). The result should look something like:
      $twikiLibPath = "/kunden/homepages/24/d87654321/htdocs/twiki/lib";
  • Now check out your configuration page at http://[your_1and1_domain]/[your_twiki_dir]/bin/configure.pl. This page makes it easy to configure many administrative settings of your TWiki installation. First, we need to look at "General Path Settings."
  • Click on the "General Path Settings" row to expand its contents. Notice the warnings and errors. TWiki is warning you that it guessed many of these settings.
  • Look at the last four directory settings, starting with "{PubDir}". Make sure that these settings look something like:
    My initial setting had an extra "bin/configure.pl" in each of those paths for some strange reason.
  • Near the bottom of the same section, find the "{ScriptSuffix}" setting. Enter ".pl" in the box (without the quotes) to match the Perl extension that 1and1 requires.
  • Click the "Next" button at the bottom of the page to use the rest of the guessed settings (which worked fine for me).
  • TWiki now prompts you to set a password to protect its configuration. I suggest using the same password as your 1and1 administration login.
  • After setting your new password, you'll get taken to a results page. Click on the "Return to configuration" link at the bottom.
  • At this point, you should have a few errors and warnings left, in various sections, but they all apply (at least for me) to a missing Perl module called "CGI::Session" and internationalization-related things, which I don't need. For now, either disable "{UseClientSessions}" in "Security Setup" (don't forget to save the changes) or take a look at number 48 of the Old Installation Instructions at the bottom of the page. At this point, only warnings should remain.
  • Now let's see if your TWiki's main page works! Go to http://www.[your_1and1_domain]/[your_twiki_dir]. I get an "Internal Server Error." So what's wrong here? It turns out that TWiki ships with perl files that don't work out-of-the-box on 1and1.
  • With SSH, in the /[your_twiki_dir]/bin directory, execute:
    chmod -v 755 *.pl
    This enables us to edit the perl files, which we'll do next.
  • In your text editor:
    • Open all the perl files (ending with .pl) in the /[your_twiki_dir]/bin directory.
    • Find-and-replace (in all open files) "#!/usr/bin/perl -wT" with "#!/usr/bin/perl".
    • Save all the files.
    • NOTE: You should be able to do this automatically using "rewriteshbang.pl" in the /[your_twiki_dir]/tools. This is what this script is designed to do, however, I have not tested it successfully -- EricWoods
  • Try your TWiki home page again, it should work! This might be another good time to make a full backup.
  • While the wiki will now work, there are still some things would may want to tweak. E.g. securing pages, email support and login sessions etc. See the TWikiInstallationGuide for more info.

TODO Set Up Login Sessions

TODO Install Perl Modules For TWiki

OLD-DO-NOT-USE BryceSchober Installation Steps

  1. Unzip TWiki-4.0.4.tgz to TWiki-4.0.4
  2. Unzip contents of hotfix-4.0.4-2.tgz over TWiki-4.0.4
  3. Rename TWiki-4.0.4 to TWiki-4.0.4-patched
  4. Execute (cygwin) "tar -cjf twiki-4.0.4-patched.tar.bz2 Twiki-4.0.4-patched"
  5. Copy twiki-4.0.4-patched.tar.bz2 to remote root
  6. Execute (remote) "tar -xjf twiki-4.0.4-patched.tar.bz2"
  7. Rename remote /Twiki-4.0.4-patched to /twiki
  8. Read http://[your_domain]/twiki/INSTALL.html
  9. Read http://twiki.org/cgi-bin/view/TWiki/SettingFileAccessRightsLinuxUnix
  10. Remote "cd twiki"
  11. 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
  12. cd ..
  13. Remote "tar -cjf twiki-20060906-step13.tar.bz2 twiki"
  14. rename /twiki/bin/.htaccess.txt to /twiki/bin/.htaccess - NOTE: Don't do this, see step 29.
  15. rename /twiki/bin/LocalLib.cfg.txt to /twiki/bin/LocalLib.cfg
  16. rename all files in /twiki/bin with no extension, adding .pl extension
  17. Remote "tar -cjf twiki-20060906-step17.tar.bz2 twiki"
  18. Download twiki-20060906-step17.tar.bz2 to local root and extract to twiki-20060906-step17
  19. Modify twiki-20060906-step17/twiki/bin/LocalLib.cfg, $twikiLibPath variable to "//htdocs/twiki/lib"
  20. Modify first "shebang" line of all .pl files in twiki-20060906-step17/twiki/bin to "#!/usr/bin/perl"
  21. Execute (cygwin) "tar -cjf twiki-20060906-step21.tar.bz2 twiki" in twiki-20060906-step17/
  22. Move twiki-20060906-step21.tar.bz2 to local root
  23. Copy twiki-20060906-step21.tar.bz2 to remote root
  24. Execute (remote) "tar -xjf twiki-20060906-step21.tar.bz2"
  25. Modify local twiki-20060906-step17/twiki/root-htaccess.txt , replacing line 13 with:
    Redirect /twiki/index.html http://[your_domain]/twiki/bin/view.pl/
  26. 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]
  27. Rename twiki-20060906-step17/twiki/root-htaccess.txt to twiki-20060906-step17/twiki/.htaccess
  28. Upload local twiki-20060906-step17/twiki/.htaccess to remote twiki/.htaccess
  29. Rename /twiki/bin/.htaccess back to /twiki/bin/.htaccess.txt - apparently I wan't supposed to do that!
  30. View http://[your_domain]/twiki/bin/configure.pl
  31. View General Path Settings - changed nothing
  32. Click Next - as per advice in General Path Settings
  33. Set password to [your_password]
  34. Return to configuration
  35. View General Path Settings
  36. Changed {PubDir}, {TemplateDir}, {DataDir}, and {LocalesDir}, removing extraneous "bin/configure.pl" from middle of path string.
  37. Save settings, return to configuration
  38. Changed GenPathSet->{ScriptSuffix} to .pl
  39. Save settings, return to configuration
  40. Changed MiscSet->{ReplaceIfEditedAgainWithin} to 0 - NOTE: This ensures that every page save generates a revision
  41. Save settings, return to configuration
  42. Created twiki@.com account, username: [your_twiki_email_user] pwd: [your_twiki_email_password]
  43. Changed Mail->{SMTP}{MAILHOST} to "smtp.1and1.com"
  44. Changed Mail->{SMTP}{SENDERHOST} to "twiki@[your_domain]"
  45. Changed Mail->{SMTP}{Username} to "[your_twiki_email_user]"
  46. Changed Mail->{SMTP}{Password} to "[your_twiki_email_password]"
  47. Save settings, return to configuration
  48. 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
  49. 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
  50. Uploaded contents of local CPAN_lib\CGI-Session-4.14\lib directory to remote /twiki/lib/CPAN/lib/
  51. Uploaded contents of local CPAN_lib\Scalar-List-Utils-1.18\lib directory to remote /twiki/lib/CPAN/lib/
  52. First successful view of http://[your_domain]/twiki/
  53. Deleted twiki-20060906-step12.tar.bz2 and TWiki-4.0.4.tar that were mistakenly in remote /twiki - not sure exactly how
  54. Remote "tar -cjf twiki-20060906-step54.tar.bz2 twiki"
  55. Set Security->{UseClientSessions} on (was already)
  56. Set Security->{Sessions}{UseIPMatching} on (was already)
  57. Changed Security->{LoginManager} to "Twiki::Client::TemplateLogin"
  58. Set Security->{PasswordManager} to "Twiki::Users::HtPasswdUser" (was already)
  59. Changed Security->{MinPasswordLength} to 6
  60. Save settings, return to configuration
  61. View http://[your_domain]/twiki/ with login / register in sidebar
  62. Registered user Main.[your_twiki_user_name]
  63. Received "click to complete" email, confirmed, received confirmation email.
  64. Logged in successfully.
  65. Uploaded ".changes", "TestHTMLImport1.txt", and "TestHTMLImport1.txt,v" files from old to new twiki/data/Sandbox
  66. Viewed http://[your_domain]/twiki/bin/view.pl/Sandbox/TestHTMLImport1 successfully.
  67. Remote "tar -cjf twiki-20060906-step67.tar.bz2 twiki"
  68. Made sure all twiki-*.bz2 archives were in local root
  69. Deleted all twiki-*.bz2 archives and old twiki-something directories
-- Contributors: BryceSchober - 10 Jan 2007


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,
     Require user {Administrators}
     Satisfy Any

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

Edit | Attach | Watch | Print version | History: r26 < r25 < r24 < r23 < r22 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r26 - 2012-09-11 - BillMiller
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2018 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.