cross
New Foswiki release 2.1.6 is available with important security fixes.
Sourceforge foswiki email lists being discontinued. Subscribe to the new Foswiki announce and discuss lists at MailingLists

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

  • Go to TWiki:Codev.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
      pwd
      
    • Enter
      wget [paste the url from above]
      
    • If there is a hotfix patch available at TWiki:Codev.DownloadTWiki, use the wget command to fetch that as well.
    • Create your TWiki's root directory by doing
      mkdir [your_twiki_dir]
      
    • 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
      
    • 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 TWiki.SettingFileAccessRightsLinuxUnix (but bear in mind 4.1.0 currently fails on 1&1).
    • Execute the following two lines:
      cp root-htaccess.txt .htaccess
       chmod -v 644 .htaccess
      
  • 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]
      </Limit>
      
      
  • 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/'
    
  • 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]
      
    • 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 the following two lines:
      cp LocalLib.cfg.txt LocalLib.cfg
       chmod -v 644 LocalLib.cfg
      
  • 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:
    /[your_root_dir]/[your_twiki_dir]/pub
    /[your_root_dir]/[your_twiki_dir]/templates
    /[your_root_dir]/[your_twiki_dir]/data
    /[your_root_dir]/[your_twiki_dir]/locale
    
  • 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
    
  • 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 InstallationGuide 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]
    </Limit>
    
  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

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

I've been able to get foswiki running on 1and1, but I haven't had any luck with editing the wiki. I imagine this is a permission issue on the hosted service, but the error message garbled and I haven't been able to find any clear direction on how to get around this problem. When I try to save any edits I get the following message:

"Error saving topic During save of Main an error was found by the version control system. Please notify your Foswiki administrator.

/usr/bin/ci -m%COMMENT|U% -t-none -w%USERNAME|S% -u %FILENAME|F% of .../Main/WebHome.txt failed:

Go back in your browser and save your changes locally. "

I can't go back and change it locally. This is getting pretty frustrating as I've read different articles from twiki and foswiki and none of the permission settings seem to be valid. Any advice at this point would be greatly appreciated.

-- DanSupinski - 26 Oct 2009

Bryce Thanks for the inforamation. 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.

originally edited -- SavBill - 08 Jul 2012 rolled back to r6, then updated with same comment to correct formatting. -- SavBill - 14 Jul 2012

-- SavBill - 14 Jul 2012
 

BasicForm edit

TopicClassification AdminTopic
Topic Summary
Extension
Interested Parties
Related Topics SharedHosting
Topic revision: r8 - 14 Jul 2012, SavBill - This page was cached on 23 Jun 2018 - 18:11.

The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy