Commit 70e2e7b0f576ccb3a00c898c64c48ca388b993b4
1 parent
1a9aa04e
Exists in
master
and in
22 other branches
General review of installation instructions
Showing
1 changed file
with
239 additions
and
72 deletions
Show diff stats
INSTALL
| @@ -13,13 +13,14 @@ You need to install some packages Noosfero depends on. On Debian GNU/Linux or | @@ -13,13 +13,14 @@ You need to install some packages Noosfero depends on. On Debian GNU/Linux or | ||
| 13 | Debian-based systems, all of these packages are available through the Debian | 13 | Debian-based systems, all of these packages are available through the Debian |
| 14 | archive. You can install them with the following command: | 14 | archive. You can install them with the following command: |
| 15 | 15 | ||
| 16 | - # aptitude install ruby rake libgettext-ruby1.8 libsqlite3-ruby rcov librmagick-ruby libredcloth-ruby libwill-paginate-ruby iso-codes libfeedparser-ruby libferret-ruby libdaemons-ruby mongrel mongrel-cluster tango-icon-theme | 16 | + # apt-get install ruby rake po4a libgettext-ruby-util libgettext-ruby1.8 libsqlite3-ruby rcov librmagick-ruby libredcloth-ruby libwill-paginate-ruby iso-codes libfeedparser-ruby libferret-ruby libdaemons-ruby mongrel mongrel-cluster tango-icon-theme |
| 17 | 17 | ||
| 18 | On other systems, they may or may not be available through your regular package | 18 | On other systems, they may or may not be available through your regular package |
| 19 | management system. Below are the links to their homepages. | 19 | management system. Below are the links to their homepages. |
| 20 | 20 | ||
| 21 | * Ruby: http://www.ruby-lang.org/ | 21 | * Ruby: http://www.ruby-lang.org/ |
| 22 | * Rake: http://rake.rubyforge.org/ | 22 | * Rake: http://rake.rubyforge.org/ |
| 23 | +* po4a: http://po4a.alioth.debian.org/ | ||
| 23 | * Ruby-GetText: http://www.yotabanana.com/hiki/ruby-gettext.html?ruby-gettext (at least version 1.9.0) | 24 | * Ruby-GetText: http://www.yotabanana.com/hiki/ruby-gettext.html?ruby-gettext (at least version 1.9.0) |
| 24 | * Ruby-sqlite3: http://rubyforge.org/projects/sqlite-ruby | 25 | * Ruby-sqlite3: http://rubyforge.org/projects/sqlite-ruby |
| 25 | * rcov: http://eigenclass.org/hiki/rcov | 26 | * rcov: http://eigenclass.org/hiki/rcov |
| @@ -33,78 +34,168 @@ management system. Below are the links to their homepages. | @@ -33,78 +34,168 @@ management system. Below are the links to their homepages. | ||
| 33 | * Mongrel: http://mongrel.rubyforge.org/ | 34 | * Mongrel: http://mongrel.rubyforge.org/ |
| 34 | * tango-icon-theme: http://tango.freedesktop.org/Tango_Icon_Library | 35 | * tango-icon-theme: http://tango.freedesktop.org/Tango_Icon_Library |
| 35 | 36 | ||
| 36 | -If you manage to install Noosfero successfully, please feel free to contact the | ||
| 37 | -Noosfero development mailing with the instructions for doing so, and we'll | ||
| 38 | -include it here. | 37 | +Note: the tango-icon-theme package is not available in Debian Lenny's main |
| 38 | +repository, because back then it was not DFSG-free (Debian Squeeze will have it | ||
| 39 | +in main). You can either add the non-free repository to your sources.list file, | ||
| 40 | +or download the .deb directly and install it manually with `dpkg -i`. In this | ||
| 41 | +case will need do install hicolor-icon-theme as well bacause tango-icon-theme | ||
| 42 | +depends on it. After that you can try the command line above again, but | ||
| 43 | +without "tango-icon-theme". | ||
| 44 | + | ||
| 45 | +If you manage to install Noosfero successfully on other systems than Debian, | ||
| 46 | +please feel free to contact the Noosfero development mailing with the | ||
| 47 | +instructions for doing so, and we'll include it here. | ||
| 39 | 48 | ||
| 40 | === Setting up a production environment | 49 | === Setting up a production environment |
| 41 | 50 | ||
| 51 | +As root user | ||
| 52 | +============ | ||
| 53 | + | ||
| 42 | NOTE: these instructions are for seting up a *production* environment. If you | 54 | NOTE: these instructions are for seting up a *production* environment. If you |
| 43 | -are going to do Noosfero development, you don't need to do these steps. See the | ||
| 44 | -HACKING file instead. | 55 | +are going to do Noosfero development, you don't need to do these steps. Stop |
| 56 | +here and see the HACKING file instead. | ||
| 57 | + | ||
| 58 | +Install memcached. On Debian: | ||
| 59 | + | ||
| 60 | +# sudo apt-get install memcached | ||
| 61 | + | ||
| 62 | +Study whether you need to raise the ammount of memory it uses for caching, | ||
| 63 | +depending on the demand you expect for your site. If you are going to run a | ||
| 64 | +high-traffic site, you will want to raise the ammount of memory reserved for | ||
| 65 | +caching. | ||
| 66 | + | ||
| 67 | +It is recommended that you run noosfero with its own user account. To create | ||
| 68 | +such an account, please do the following: | ||
| 69 | + | ||
| 70 | +# sudo adduser --system --group noosfero --shell /bin/sh --home /var/lib/noosfero noosfero | ||
| 71 | + | ||
| 72 | +(note that you can change the $HOME directory of the user if you wish, here we | ||
| 73 | +are using /var/lib/noosfero) | ||
| 74 | + | ||
| 75 | +The --system option will tell adduser to create a system user, i.e. this user | ||
| 76 | +will not have a password and cannot login to the system directly. To become | ||
| 77 | +this user, you have to use sudo: | ||
| 78 | + | ||
| 79 | +# sudo -u noosfero -i | ||
| 80 | + | ||
| 81 | +or | ||
| 82 | + | ||
| 83 | +# sudo su - noosfero | ||
| 84 | + | ||
| 85 | +As noosfero user | ||
| 86 | +================ | ||
| 87 | + | ||
| 88 | +Enter the directory where you unpacked noosfero (or do it now and enter the | ||
| 89 | +directory). Here we are cloning the noosfero repository from git, but you can | ||
| 90 | +do it with a tarball as well. | ||
| 91 | + | ||
| 92 | +$ git clone git://git.colivre.coop.br/noosfero.git current | ||
| 93 | +$ cd current | ||
| 94 | +$ git checkout -b stable origin/stable | ||
| 95 | + | ||
| 96 | +Copy config/ferret_server.yml.dist to config/ferret_server.yml. You will | ||
| 97 | +probably not need to customize this configuration, but have a look at it. | ||
| 98 | + | ||
| 99 | +Create the mongrel configuration file: | ||
| 100 | + | ||
| 101 | +$ mongrel_rails cluster::configure | ||
| 102 | + | ||
| 103 | +Edit config/mongrel_cluster.yml to suit your needs. Make sure your apache | ||
| 104 | +configuration matches the mongrel cluster configuration, specially in respect | ||
| 105 | +to the ports and numbers of mongrel instances. | ||
| 106 | + | ||
| 107 | +Note: currently Noosfero only supports Rails 2.1.0, which is the version in | ||
| 108 | +Debian Lenny. If you have a Rails version newer than that, Noosfero will | ||
| 109 | +probably not work. You can install Rails 2.1.0 into your Noosfero installation | ||
| 110 | +with the following procedure: | ||
| 111 | + | ||
| 112 | +$ cd /var/lib/noosfero/current/vendor | ||
| 113 | +$ wget http://ftp.de.debian.org/debian/pool/main/r/rails/rails_2.1.0.orig.tar.gz | ||
| 114 | +$ tar xzf rails_2.1.0.orig.tar.gz | ||
| 115 | +$ ln -s rails-2.1.0 rails | ||
| 116 | + | ||
| 117 | +As root user | ||
| 118 | +============ | ||
| 119 | + | ||
| 120 | +Setup Noosfero log and tmp directories: | ||
| 121 | + | ||
| 122 | +# cd /var/lib/noosfero/current | ||
| 123 | +# sudo etc/init.d/noosfero setup | ||
| 124 | + | ||
| 125 | +Now it's time to setup the database. In this example we are using PostgreSQL, | ||
| 126 | +so if you are planning to use a different database this steps won't apply. | ||
| 127 | + | ||
| 128 | +# apt-get install postgresql libpgsql-ruby | ||
| 129 | +# su postgres -c 'createuser noosfero' | ||
| 130 | +Shall the new role be a superuser? (y/n) n | ||
| 131 | +Shall the new role be allowed to create databases? (y/n) y | ||
| 132 | +Shall the new role be allowed to create more new roles? (y/n) n | ||
| 133 | + | ||
| 134 | +As noosfero user | ||
| 135 | +================ | ||
| 136 | + | ||
| 137 | +Now create the databases: | ||
| 45 | 138 | ||
| 46 | -* install memcached. Study whether you need to raise the ammount of memory it uses for caching, depending on the demand you expect for your site. | ||
| 47 | -* enter the directory where you unpacked noosfero | ||
| 48 | -* copy config/ferret_server.yml.dist to config/ferret_server.yml | ||
| 49 | -* create the mongrel configuration file: `mongrel_rails cluster::configure` | ||
| 50 | -** then edit config/mongrel_cluster.yml to suit your environment. Make sure your apache configuration matches the mongrel cluster configuration, specially in respect to the ports and numbers of mongrel instances. | ||
| 51 | -* create needed temporary directories: | ||
| 52 | - mkdir tmp | ||
| 53 | - mkdir tmp/pids | ||
| 54 | - mkdir log | ||
| 55 | -* create database (example using PostgreSQL, YMMV) | 139 | +$ cd /var/lib/noosfero/current |
| 140 | +$ createdb noosfero_production | ||
| 141 | +$ createdb noosfero_development | ||
| 142 | +$ createdb noosfero_test | ||
| 56 | 143 | ||
| 57 | - root user | ||
| 58 | - ========= | ||
| 59 | - # sudo apt-get install postgresql libpgsql-ruby | ||
| 60 | - # su - postgres | 144 | +The development and test databases are actually optional. If you are creating a |
| 145 | +stricly production server, you will probably not need them. | ||
| 61 | 146 | ||
| 62 | - postgres user | ||
| 63 | - ============= | ||
| 64 | - postgres@HOST:~$ createuser noosfero | ||
| 65 | - Shall the new role be a superuser? (y/n) n | ||
| 66 | - Shall the new role be allowed to create databases? (y/n) y | ||
| 67 | - Shall the new role be allowed to create more new roles? (y/n) n | 147 | +Now we want to configure Noosfero for accessing the database we just created. |
| 148 | +To do that, you can 1) copy config/database.yml.pgsql to config/database.yml, | ||
| 149 | +or create config/database.yml from scratch with the following content: | ||
| 68 | 150 | ||
| 69 | - noosfero_user | ||
| 70 | - ============= | ||
| 71 | - createdb noosfero_production | ||
| 72 | - createdb noosfero_development | ||
| 73 | - createdb noosfero_test | 151 | + production: |
| 152 | + adapter: postgresql | ||
| 153 | + encoding: unicode | ||
| 154 | + database: noosfero_production | ||
| 155 | + username: noosfero | ||
| 74 | 156 | ||
| 75 | -* configure database access in config/database.yml | 157 | +Now, to test the database access, you can fire the Rails database console: |
| 76 | 158 | ||
| 77 | -* test database access: | ||
| 78 | -** first create the development database | ||
| 79 | - rake db:schema:load | ||
| 80 | -** if everything goes right, then create the production database: | ||
| 81 | - RAILS_ENV=production rake db:schema:load | 159 | +$ ./script/dbconsole production |
| 82 | 160 | ||
| 83 | -* create sample data: | ||
| 84 | - RAILS_ENV=production rake db:populate | 161 | +If it connects to your database, then everything is fine. If you got an error |
| 162 | +message, then you have to check your database configuration. | ||
| 85 | 163 | ||
| 86 | -* Add the domain name you will be using for your noosfero site to the list of | ||
| 87 | - environment domain, like this: | 164 | +Create the database structure: |
| 88 | 165 | ||
| 89 | - ./script/runner "Environment.default.domains << Domain.new(:name => 'your.domain.com')" | 166 | +$ RAILS_ENV=production rake db:schema:load |
| 90 | 167 | ||
| 91 | - (of course, replace your.domain.com with your real domain) | 168 | +Now we have to create some initial data. To create your default environment |
| 169 | +(the first one), run the command below: | ||
| 92 | 170 | ||
| 93 | -* compile the translations: | ||
| 94 | - rake makemo | 171 | +$ RAILS_ENV=production ./script/runner 'Environment.create!(:name => "My environment", :is_default => true)' |
| 95 | 172 | ||
| 96 | -* start the server: | ||
| 97 | - ./script/production start | 173 | +(of course, replace "My environment" with your environment's name!) |
| 98 | 174 | ||
| 99 | -* to stop the server: | 175 | +And now you have to add the domain name you will be using for your noosfero |
| 176 | +site to the list of domains of that default environment you just created: | ||
| 100 | 177 | ||
| 101 | - ./script/production stop | 178 | +$ RAILS_ENV=production ./script/runner "Environment.default.domains << Domain.new(:name => 'your.domain.com')" |
| 102 | 179 | ||
| 103 | -* to restart the server: | 180 | +(replace "your.domain.com" with your actual domain name) |
| 104 | 181 | ||
| 105 | - ./script/production restart | 182 | +Compile the translations: |
| 106 | 183 | ||
| 107 | -* enable the following apache modules: | 184 | +$ RAILS_ENV=production rake noosfero:translations:compile |
| 185 | + | ||
| 186 | +To start the Noosfero application servers: | ||
| 187 | + | ||
| 188 | +$ ./script/production start | ||
| 189 | + | ||
| 190 | +At this point you have a functional Noosfero installation running, the only | ||
| 191 | +thing left is to configure your webserver as a reverse proxy to pass requests | ||
| 192 | +to them. | ||
| 193 | + | ||
| 194 | +==================== | ||
| 195 | +Apache configuration | ||
| 196 | +==================== | ||
| 197 | + | ||
| 198 | +Firts you have to enable the following some apache modules: | ||
| 108 | 199 | ||
| 109 | deflate | 200 | deflate |
| 110 | expires | 201 | expires |
| @@ -113,26 +204,32 @@ HACKING file instead. | @@ -113,26 +204,32 @@ HACKING file instead. | ||
| 113 | proxy_http | 204 | proxy_http |
| 114 | rewrite | 205 | rewrite |
| 115 | 206 | ||
| 116 | - On Debian GNU/Linux system, these modules can be enabled with the following | ||
| 117 | - command line, as root: | 207 | +On Debian GNU/Linux system, these modules can be enabled with the following |
| 208 | +command line, as root: | ||
| 209 | + | ||
| 210 | +# a2enmod deflate expires proxy proxy_balancer proxy_http rewrite | ||
| 118 | 211 | ||
| 119 | - a2enmod deflate expires proxy proxy_balancer proxy_http rewrite | 212 | +In other systems the way by which you enable apache modules may be different. |
| 120 | 213 | ||
| 121 | - In other systems the way by which you enable apache modules may be different. | 214 | +Now with the Apache configuration. You can use the template below, replacing |
| 215 | +/var/lib/noosfero/current with the directory in which your noosfero | ||
| 216 | +installation is, your.domain.com with the domain name of your noosfero site. | ||
| 217 | +We are assuming that you are running two mongrel instances on ports 3000 and | ||
| 218 | +3001. If your setup is different you'll need to adjust <Proxy> section. If you | ||
| 219 | +don't understand something in the configuration, please refer to the apache | ||
| 220 | +documentation. | ||
| 122 | 221 | ||
| 123 | -* Configure apache web server as a reverse proxy. You can use the template | ||
| 124 | - below, replacing /path/to/noosfero with the directory in which your noosfero | ||
| 125 | - installation is, your.domain.com with the domain name of your noosfero site. | ||
| 126 | - We are assuming that you are running two mongrel instances on ports 4000 and | ||
| 127 | - 4001. If your setup is different you'll need to adjust <Proxy> section. If | ||
| 128 | - you don't understand something in the configuration, please refer to the | ||
| 129 | - apache documentation. | 222 | +Add a file called "mysite" (or whatever name you want to give to your noosfero |
| 223 | +site) to /etc/apache2/sites-available with the following content, and customize | ||
| 224 | +as needed (as usual, make sure you replace "your.domain.com" with you actual | ||
| 225 | +domain name, and "/var/lib/noosfero/current" with the directory where Noosfero | ||
| 226 | +is installed): | ||
| 130 | 227 | ||
| 131 | <VirtualHost *:80> | 228 | <VirtualHost *:80> |
| 132 | ServerName your.domain.com | 229 | ServerName your.domain.com |
| 133 | 230 | ||
| 134 | - DocumentRoot "/path/to/noosfero/public" | ||
| 135 | - <Directory "/path/to/noosfero/public"> | 231 | + DocumentRoot "/var/lib/noosfero/current/public" |
| 232 | + <Directory "/var/lib/noosfero/current/public"> | ||
| 136 | Options FollowSymLinks | 233 | Options FollowSymLinks |
| 137 | AllowOverride None | 234 | AllowOverride None |
| 138 | Order Allow,Deny | 235 | Order Allow,Deny |
| @@ -156,18 +253,88 @@ HACKING file instead. | @@ -156,18 +253,88 @@ HACKING file instead. | ||
| 156 | LogLevel warn | 253 | LogLevel warn |
| 157 | CustomLog /var/log/apache2/noosfero.access.log combined | 254 | CustomLog /var/log/apache2/noosfero.access.log combined |
| 158 | 255 | ||
| 159 | - Include /path/to/noosfero/etc/noosfero/apache/cache.conf | 256 | + Include /var/lib/noosfero/current/etc/noosfero/apache/cache.conf |
| 160 | 257 | ||
| 161 | </VirtualHost> | 258 | </VirtualHost> |
| 162 | 259 | ||
| 163 | <Proxy balancer://noosfero> | 260 | <Proxy balancer://noosfero> |
| 164 | - BalancerMember http://127.0.0.1:4000 | ||
| 165 | - BalancerMember http://127.0.0.1:4001 | 261 | + BalancerMember http://127.0.0.1:3000 |
| 262 | + BalancerMember http://127.0.0.1:3001 | ||
| 166 | Order Allow,Deny | 263 | Order Allow,Deny |
| 167 | Allow from All | 264 | Allow from All |
| 168 | </Proxy> | 265 | </Proxy> |
| 169 | 266 | ||
| 170 | - The cache.conf file included in the end of the <VirtualHost> section is | ||
| 171 | - important, since it will tell apache to pass expiration and cache headers to | ||
| 172 | - clients so that the site feels faster for users. Do we need to say that using | ||
| 173 | - that configuration is strongly recommended? | 267 | +The cache.conf file included in the end of the <VirtualHost> section is |
| 268 | +important, since it will tell apache to pass expiration and cache headers to | ||
| 269 | +clients so that the site feels faster for users. Do we need to say that using | ||
| 270 | +that configuration is strongly recommended? | ||
| 271 | + | ||
| 272 | +Enable that site with (as root, replace "mysite" with the actual name you gave | ||
| 273 | +to your site configuration): | ||
| 274 | + | ||
| 275 | +# a2ensite mysite | ||
| 276 | + | ||
| 277 | +Now restart your apache server (as root): | ||
| 278 | + | ||
| 279 | +# invoke-rc.d apache2 restart | ||
| 280 | + | ||
| 281 | +============ | ||
| 282 | +Maintainance | ||
| 283 | +============ | ||
| 284 | + | ||
| 285 | +To ease the maintainance, install a symbolic link for the Noosfero startup | ||
| 286 | +script in your server and add it to the system initialization and shutdown | ||
| 287 | +sequences (as root): | ||
| 288 | + | ||
| 289 | +# ln -s /var/lib/noosfero/current/etc/init.d/noosfero /etc/init.d/noosfero | ||
| 290 | +# update-rc.d noosfero defaults | ||
| 291 | + Adding system startup for /etc/init.d/noosfero ... | ||
| 292 | + /etc/rc0.d/K20noosfero -> ../init.d/noosfero | ||
| 293 | + /etc/rc1.d/K20noosfero -> ../init.d/noosfero | ||
| 294 | + /etc/rc6.d/K20noosfero -> ../init.d/noosfero | ||
| 295 | + /etc/rc2.d/S20noosfero -> ../init.d/noosfero | ||
| 296 | + /etc/rc3.d/S20noosfero -> ../init.d/noosfero | ||
| 297 | + /etc/rc4.d/S20noosfero -> ../init.d/noosfero | ||
| 298 | + /etc/rc5.d/S20noosfero -> ../init.d/noosfero | ||
| 299 | + | ||
| 300 | +Now to start Noosfero, you do as root: | ||
| 301 | + | ||
| 302 | +# invoke-rc.d noosfero start | ||
| 303 | + | ||
| 304 | +To stop Noosfero: | ||
| 305 | + | ||
| 306 | +# invoke-rc.d noosfero start | ||
| 307 | + | ||
| 308 | +To restart Noosfero: | ||
| 309 | + | ||
| 310 | +# invoke-rc.d noosfero restart | ||
| 311 | + | ||
| 312 | +Noosfero will be automatically started during system boot, and automatically | ||
| 313 | +stopped if the system shuts down for some reason (or during the shutdown part | ||
| 314 | +of a reboot). | ||
| 315 | + | ||
| 316 | +========= | ||
| 317 | +Upgrading | ||
| 318 | +========= | ||
| 319 | + | ||
| 320 | +If you followed the steps in this document and installed Noosfero from the git | ||
| 321 | +repository, then upgrading is easy. As the noosfero user, do the following: | ||
| 322 | + | ||
| 323 | +$ cd /var/lib/noosfero/current | ||
| 324 | +$ ./script/git-upgrade | ||
| 325 | + | ||
| 326 | +The git-upgrade script will take care of everything for you. It will first stop | ||
| 327 | +the service, then fetch the current source code, upgrade database, compile | ||
| 328 | +translations, and then start the service again. | ||
| 329 | + | ||
| 330 | +Note 1: make sure your local git repository is following the "stable" branch, | ||
| 331 | +just like the instructions above. The "master" branch is not recommended for | ||
| 332 | +use in production environments. | ||
| 333 | + | ||
| 334 | +Note 2: always read the release notes before upgrading. Sometimes there will be | ||
| 335 | +steps that must be performed manually. If that is the case, you can invoke the | ||
| 336 | +git-upgrade script with the special parameter "--shell" that will give you a | ||
| 337 | +shell after the upgrade, which you can use to perform any manual steps | ||
| 338 | +required: | ||
| 339 | + | ||
| 340 | +$ ./script/git-upgrade --shell |