forked from SoylentNews/rehash
-
Notifications
You must be signed in to change notification settings - Fork 0
/
INSTALL
1089 lines (824 loc) · 47.4 KB
/
INSTALL
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
NAME
INSTALL - Rehash Installation
SYNOPSIS
This document describes how to install Rehash 15.05 and later. Always
check your distributions version of INSTALL for version specific
information.
These instructions have only been tested on Linux. Historically,
installation under BSD and other Unix OSes is doable, with minor
glitches (see "BSD Systems" below). Windows is not supported.
Rehash is available on github; it is recommended that sites pull from
the current HEAD of the repo, but if you prefer a more stable platform,
tagged releases are made on roughly 2-3 month basis.
If in doubt, rehash's canonical development site is:
https://github.com/soylentnews/rehash
Read, then install
We know you want to get right into the installation, but you must first
read, carefully, these sections of this INSTALL file:
* REQUIREMENTS, to make sure you have the right hardware and software
* SECURITY NOTES, to keep your system safe
* INSTALLATION (the longest section), to make sure you will be able to
finish what you start
And it's a good idea to at least skim:
* INSTALLATION OPTIONS
* TROUBLESHOOTING
Read those sections before you begin actually performing the steps in
"INSTALLATION".
This document also contains information on upgrading a Slash site (which
can be tricky), and uninstalling (which is easy).
INSTALLATION
Rehash Environment
Rehash requires a stable mod_perl 2 running against Apache 2.2. While
efforts have been underway to port mod_perl to Apache 2.4, this port is
as of writing unable to support rehash to extensive use of the mod_perl
API throughout the codebase. Unfortunately, most Linux distributions
have chosen to ship this experimental branch, and no longer provide the
older Apache 2.2 packages anymore.
Furthermore, rehash depends on a fair number of perl modules that must
be installed into the site_perl directory as they are shared between
both Apache and slashd. As such, its recommended to build and install an
independent version of Perl to accommodate rehash. This also allows
installation and management by a non-root user.
To ease this process, rehash provides a "build-environment" target which
automatically downloads, compiles, and installs Apache, Perl, mod_perl,
and all the dependent CPAN modules. Although it is possible to run
rehash without this, using "build-environment" is the recommended way to
make sure you're always running the lastest and most up-to-date
packages.
If you choose to set your own environment up here are the following
known gotchas that we're aware of. It's strongly recommended if you do
this that you open Makefile to get the definitive list of CPAN modules
currently required for rehash.
* Perl must be built as a shared library (libperl.so), and be built
with threading support Without both, mod_perl installation *will*
fail.
* Apache should be built with a default MPM of prefork vs. worker
- Worker *should* be safe, but we still have areas of the code
where we need to get $r dynamically, which has a massive
performance penality under worker. Prefork gives behavior
consistent with Apache 1.3 and is recommended for now.
* Perl passes both the CPPFLAGS and LDFLAGS set by Configure to CPAN
modules. This is important if the mysql, GD and SSL headers are in
non-standard locations on your system, or if you've built these
packages manually.
* rehash can use both standard MySQL (referred to as "vanilla" below)
or MySQL Cluster. We use both configurations at soylentnews.org,
with production and dev on cluster, and our staff rehash instance
using vanilla. For high-availability, the use of MySQL cluster is
*highly* recommended. When using vanilla, all tables use InnoDB;
likewise, in cluster, all tables use the NDB type. When using
vanilla MySQL rehash supports using read-only replicas for
performance boosts.
* As of this writing, soylentnews.org currently uses pre-generated
binaries of MySQL Cluster from mysql.com vs. Ubuntu's mysql
packages. As MySQL's protocol is stable, its acceptable if you link
against libmysqlclient-dev as provided by your distribution than the
version specifically.
Installation Note
All of the installation steps below should be executed as root. If this
is a problem, then Slash is probably not for you (see "Non-Root" below,
under "INSTALLATION OPTIONS"). Type carefully. Now's a good time to back
up anything important.
Installation Procedure
There are eight steps to installation. Anything already done can be
skipped -- but only if you have the correct version and configuration,
particularly with Apache/mod_perl.
0. Install system dependencies
Rehash's build-environment target assumes a few libraries are
available for Perl and perl modules to link against. You also need a
C compiler. As of writing, you need the following for successful
installation
* GD
* OpenSSL (LibreSSL should also work, but untested)
* MySQL client libraries
On Ubuntu 14.04, the following commands will get everything you
need:
$ sudo apt-get install build-essential libgd-dev
libmysqlclient-dev zlib1g zlib1g-dev libexpat1-dev
* 1.
Configure the server to be in UTC time
For sanity reasons, rehash requires the server timezone be set
to UTC. You can check the timezone using the 'date' command. If
it reports UTC like this:
$ date Mon Jun 15 23:47:19 UTC 2015
Then you're good to go. If it reports something like EDT, PDT,
or similar, you need to change the system timezone. On
Debian-based systems, you can do this by running
'dpkg-reconfigure tzdata' as root.
* 2. Create the MySQL Database
If it is already installed, doublecheck that its version is at
least the minimum required (see "REQUIREMENTS"). If you have
questions about the installation process, please refer to MySQL
documentation.
Start MySQL (it must be running for the installation of Slash
and some perl modules). Or, if it is already running, restart
MySQL (if you have other services using MySQL, you should
probably stop and start them -- make sure they are
timezone-agnostic!).
Create a database to be used by Rehash. Our default name is
'rehash':
CREATE DATABASE rehash;
Create a username/password that can access that database, and
ensure that user has at least privileges to select, insert,
update, delete, lock, create, drop, index and alter. For
example, if your whole site (slashd daemon and apache) will run
on the same machine as your mysql server, and you wanted to use
the mysql username 'slash', you might:
GRANT SELECT, INSERT, UPDATE, DELETE, LOCK TABLES, CREATE, DROP,
INDEX, ALTER ON rehash.* TO 'rehash'@'localhost'
IDENTIFIED BY (quoted password);
GRANT PROCESS ON *.* TO 'rehash'@'localhost' IDENTIFIED BY
(quoted password);
In this case, 'rehash' would also be the name of your MySQL user
as described in "Types of Users" below. You'll have to give your
MySQL user to DBIx::Password when you install and configure it,
so don't forget it.
NOTE: For MySQL Cluster users, the user must be created on each
mysqld instance unless the mysql database itself is replicated
via NDB. See the documentation for MySQL Cluster for more
information.
* 2.
Build the rehash environment.
Once MySQL is sorted, you're ready to build rehash's
dependencies. This is an automated process, though some CPAN
modules may prompt for configuration information. The rehash
environment is installed to the location dictated by the
ENVIRONMENT_PREFIX variable, which by default is set to
/opt/rehash-environment.
Rehash download and build Apache and Perl and place them in
version-specific directories. For example, as of this writing,
the most recent version of Perl is 5.22 and Apache 2.2.29. These
will be installed to $ENVIRONMENT_PREFIX/apache-2.2.29 and
$ENVIRONMENT_PREFIX/perl-5.22.0; older versions of Apache and
Perl are left in place, allowing for ease of upgrade. It's
recommended that the rehash system user has their home folder
set to $ENVIRONMENT_PREFIX.
As root, from the base of the rehash folder, execute the
following command
# make build-environment install
By default, this command uses the following defaults:
ENVIRONMENT_PREFIX=/opt/rehash-environment
SLASH_PREFIX=$(ENVIRONMENT_PREFIX)/rehash
You can override these on the command line as you see fit as
such:
# make ENVIRONMENT_PREFIX=/srv/soylentnews.org build-environment
Running "install" as root is necessary at least once to install
the init script for slashd. Alternatively, it can be manually
installed; the script is in utils/slashd and should work with
any SysV compatible init system.
build-environment will download Apache, Perl, and mod_perl, and
run the test suite on each; if the test suite fails, the build
is aborted, and it is left to the user to try and correct test
failures. Rehash keeps track of what its built via files in the
stamp/ directory, and will not try and rebuild components that
have succeeded. It will also add the necessary LoadModule and
Include lines for Apache to load mod_perl, and the rehash
httpd.conf.
For Perl modules, rehash will first install cpanminus with a
copy of cpanm shipped in the utils folder. cpanminus is Perl
script that automates and simplifies the management of CPAN
modules, and automatically grabs the latest version of said
modules.
dev.soylentnews.org is regularly updated and rebuilt via
build-environment to test rehash against these modules, and work
is underway to provide unit tests for most of rehash's
functionality. If you encounter an issue due to a specific CPAN
module, please file a bug on it, and we'll work on fixing
compability if we haven't already caught the same issue. After
this step, the only major reverse dependency to handle is
DBIx::Password
* 3.
Install DBIx::Password
Communication between Rehash and the database module is handled
by by a perl module known as DBIx::Password. Under
DBIx::Password, each instance of rehash is managed by a 'virtual
user', which in turn corresponds to a DBD connection string. For
a more in-dpeth explination, the CPAN page on DBIx::Password is
extremely informative:
<http://search.cpan.org/~krow/DBIx-Password-1.9/Password.pm>
An example season of install-dbix-password is posted below
$ sudo make install-dbix-password
/opt/rehash-environment/perl-5.22.0/bin/cpanm --interactive DBIx::Password
--> Working on DBIx::Password
Fetching http://www.cpan.org/authors/id/K/KR/KROW/DBIx-Password-1.9.tar.gz ... OK
Configuring DBIx-Password-1.9 ... What is the name of the Virtual User?
slash
What is the dbi driver? (AKA mysql)
mysql
What is the name of the database?
rehash
What is the name of the machine that the database is on?
Is the database on any special port(you should probably just hit return)?
What is the username?
rehash
What is the password?
myrehashsite
What attributes would you like to add?
(Enter nothing to skip or finish)
What is the name of the Virtual User?
(Enter nothing if you are finished adding users.)
Checking if your kit is complete...
Looks good
Generating a Unix-style Makefile
Writing Makefile for DBIx::Password
Writing MYMETA.yml and MYMETA.json
OK
slash is the defaut user used for most scripts. If the machine
name is left blank, rehash will try and communicate via a local
socket to the mysql server. DBIx::Password's test suite will
fail if it can't establish a connection to the backend.
NOTE: There's no line break between Configuring
DBIx-Password-1.9 ... and "What is the name of virtual user",
simply type in the name when prompted, and press enter.
* 4.
Install Rehash.
After the environment is installed, rehash itself must be
installed into said environment. Make sure rehash's copy of
Perl and Apache are in the path (use 'which perl' to confirm),
then type:
make install
Note: you will want the GNU versions of coreutils and make.
Older versions of install, and make and cp from other systems,
might not work.
There are a few options to "make" and "make install" you may
want to change.
option default purpose
==========================================================
SLASH_PREFIX /opt/rehash-environment/rehash Location for
installed files
INIT /etc or /etc/rc.d Location for init
scripts
USER nobody User to own files
GROUP nobody Group to own files
CP cp Name of or path to
alternate 'cp'
INSTALL install Name of or path to
alternate 'install'
(USER and GROUP can also be changed later on a per-site basis,
in step 6, while running "install-slashsite".)
So, for example, you might type (although the default
SLASH_PREFIX is *strongly* recommended):
make install SLASH_PREFIX=/home/slash
When done, a configuration file for Apache will be created at
$SLASH_PREFIX/httpd/slash.conf. You can put its contents into
your httpd.conf, or you can just "Include" it in your
httpd.conf. You must do one or the other!
WARNING!
Please be aware that if you include $SLASH_PREFIX/slash.conf or
$SLASH_PREFIX/sites/sitename/sitename.conf more than once, or if
this file shares contents with directives in httpd.conf, that
your Rehash site WILL break. The directives in
$SLASH_PREFIX/slash.conf should be run only ONCE in any any site
context. Read through $SLASH_PREFIX/slash.conf to make sure it
all looks proper.
* 5.
Install your Slash site.
At this point, you may want to (re)read "DBIx::Password" in
"SECURITY NOTES" at the end of this section, and consider the
option of installing your site with a custom unix system user
and group for added security. You will be prompted for user and
group shortly.
Go to your installation directory (by default, /usr/local/slash)
and execute (where "VIRTUAL_USER" is the name of the virtual
user given in the DBIx::Password distribution):
bin/install-slashsite -u VIRTUAL_USER
The program will prompt for answers to several configuration
questions. Then it will install your site.
Another configuration file will be created at
$SLASH_PREFIX/$SITENAME/$SITENAME.conf, which will be
"Include"'d in $SLASH_PREFIX/httpd/slash.conf. You'll want to
add an "Include" for the latter in your Apache's httpd.conf if
you haven't done so on a previous site install.
If you are using virtual hosting by hostname, you may also need
to add a NameVirtualHost.
If you don't have your Rehash site in the root of the web server
(e.g., http://www.example.com/mysite/ instead of the more usual
http://www.example.com/), you will need to adjust the rootdir,
rdfimage, imagedir, absolutedir, and cookiepath variables, and
you also need to change your Apache config appropriately. If
you're planning on having sections with more than two dots in
the hostname (e.g. your mainpage will be at
http://division.company.com/ with a section at
http://newprojects.division.company.com/) you will also want to
set the cookiedomain var (e.g. to .division.company.com). These
are all in the vars table of your database.
NOTE: Read the message printed at the end of running
install_slashsite. Failure to pay attention here is another
common reason we see for Slash installations not working.
Ubuntu NOTE: Reported after installing on Kubuntu 7.10, a Slash
install's idea of run-levels was not sufficient to start slashd
at boot. The following makes sure that all the right run-levels
are covered, and that rebuilding Slash won't mistakenly
double-start the daemon:
sudo update-rc.d -f slash remove
sudo update-rc.d slash defaults
sudo mv /etc/rc3.d/S*slash /etc/rc3.d/S99slash
sudo mv /etc/rc6.d/K*slash /etc/rc6.d/K99slash
Finally, make sure the templates and symlinks are properly
installed by rehash. As the rehash user, run the following
commands cd /opt/rehash-enviornment/rehash bin/template-tool -U
bin/symlink-tool -U
You should be good to go at this point
* 6.
Start it up.
After installation of the site is done, you'll need to start
Apache. Stop it if necessary, then start it:
apachectl -k stop
apachectl -k start
Then run slashd. This should be done via the init script:
/etc/init.d/slash start
slashd is the daemon that runs routine maintenance on Rehash
sites, including sending out daily mailings, cleaning up the
database, and updating stories. The init script above will start
up an individual slashd daemon process for each installed site
(and while running, they will spawn child processes, some of
which may run for a long time or until you stop slashd with
"slash stop").
Now's a good time to (re)read the "SECURITY NOTES" section at
the end of this file.
* 7.
Stay in touch.
The rehash development team lives in #dev on
irc.soylentnews.org. We'd love to hear from you if you're
running rehash, and would be able to provide assistance and
tips.
INSTALLATION OPTIONS
Multiple Servers
You can, of course, have a separate database server from your Rehash
server. Further, you can have multiple web servers for one Rehash site,
and a good thing too because web server RAM/CPU will probably be your
first bottleneck as your site grows.
SoylentNews has one primary server with all of the code (Apache, perl,
etc.) in /srv/soylentnews.org. That server runs slashd. Our slashd
writes directly to its /srv/soylentnews.org/rehash. During a site
upgrade, the entire /srv/soylentnews.org folder is rsynced to each of
the web frontends in turn. During normal site operations, just
/srv/soylentnews.org/rehash is synced for files written out by slashd.
Some notes:
* Make sure the MySQL server allows the user to log in from each web
server, and the slashd server.
* Make sure, if you use the same httpd tree on all machines, that the
httpd.conf is listening to the proper IP addresses. This can be done
by putting all of the IP addresses in the conf file, or by having a
separate Listen file on each machine. Similarly, make sure that each
web server's logfiles are unique to each machine, not written to the
NFS volume.
Virtual Hosts
Rehash has support for virtual hosts, so you can have multiple rehash
sites on one machine. Simply execute step 6 in the install process for
each Slash site (after adding a new virtual user to DBIx::Password for
each).
SSL
In Rehash, there are two variables for the root URL of the site.
absolutedir is the full URL, including protocol, while rootdir is the
URL without protocol:
absolutedir http://slashcode.com
rootdir //slashcode.com
absolutedir is used only for creating external links to the site (such
as in RSS files). rootdir is used for internal links; that way, you can
use the same HTML pages for SSL and non-SSL. You don't have to do
anything special to the code or preferences to allow it to work with SSL
by itself, SSL and non-SSL together, or non-SSL by itself.
Memcached
AS OF REHASH 14.05, MEMCACHE SUPPORT IS BROKEN, THIS IS LEFT FOR
HISTORICAL REASONS UNTIL SUCH SUPPORT IS FIXED
Memcached is not required, but Rehash includes optimizations that move
load from your (expensive) MySQL server to a (very cheap) memcached
server or servers. If you are concerned about performance, this is one
of the first options to install. You can probably install it using your
operating system's package management, and/or see
http://www.danga.com/memcached/.
A 64 or 128 MB memcached instance should be plenty for moderate-sized
rehash sites. Just set the vars 'memcached', 'memcached_keyprefix', and
'memcached_servers', and restart apache and slashd. That's it.
UPGRADING
In general, upgrading rehash is a straight forward affair. If desired,
you can run build-environment to upgrade Apache/Perl/mod_perl/CPAN to
the latest versions. After doing so, simply copy the DBIx/Password.pm
file from the old perl directory to the new, apply any Apache
configuration changes as necessary.
After updating the environment, examine sql/mysql/upgrades for necessary
SQL stanzas required for the update; these must be run on your database.
As a rule, we don't break backwards compatability across versions; i.e.
the previous release will work with the current release, so you can
safely update the database while live. Run "make install" to update the
rehash directory and global perl modules.
Restart Apache, and you're good to go.
UPGRADING LEGACY SLASHSITES
NC: This is left mostly as is for historical slash and slashcode sites,
and is not tested. In general, it should be possible to upgrade through
to the tip of the slashcode git repo, then through our old slashcode
releases, then onto rehash. See sql/mysql/upgrades_legacy upgrades_slashcode
to determine which database upgrades are necessary. However, this procedure
is untested, and some Slash functionality such as firehose and D2 has been
removed from our codebase
Some of these upgrade procedures are still in testing. Please read them
entirely before beginning. We are not responsible for any loss of data
or functionality.
Slash 1.0 -> Slash 2.2
You've got a site running Slash 1.0, from 2001? We're so sorry to hear
that.
Please read the complete documentation of utils/slash1toslash2.2. We
believe it will convert your database from Slash 1.0 to a new Slash 2.2
database, but it hasn't been tested in some time. The program
documentation (which can be read with perldoc) details exactly what
process it follows to do the conversion, so you can attempt to do it by
hand if you prefer.
Slash 2.0 -> Slash 2.2
Slash 2.2 is a major upgrade from Slash 2.0. It takes a little bit of
work to get it going.
1. BACK EVERYTHING UP ON THE EXISTING SITE.
2. Install Bundle::Slash. If you have done so previously, follow the
instructions for removing the existing version of Bundle::Slash
before proceeding.
3. Apply this patch to your installed Slash::Install module (probably
easiest to hand-edit the file):
--- Install.pm~ Wed May 9 15:02:34 2001
+++ Install.pm Fri Sep 28 12:44:41 2001
@@ -116,7 +116,7 @@
sub writeTemplateFile {
my($self, $filename, $template) = @_;
open(FILE, '>' . $filename) or die "$! unable to open file $filename to write to";
- for (keys %$template) {
+ for (qw(section description title page lang name template seclev)) {
next if ($_ eq 'tpid');
print FILE "__${_}__\n";
$template->{$_} =~ s/\015\012/\n/g;
4. Run "template-check" on your site, and make a note of every change
you've made to the standard templates. You will need to make those
changes again, manually, later.
This is unfortunately unavoidable, because templates include code
that changes significantly between releases. It is recommended that
you compile your changes into a THEME so they may easily be updated
and applied.
5. Stop Apache and slashd on the target machine(s).
6 Install Slash.
If installing on a different machine ...
1 Install slash 2.2 as normal. Do not yet run "install-slashsite".
2 Make sure that from this machine, you can access not only the
database used for this installation, but the one used for the
old installation. You may wish to, instead of accessing that
database directly if it on another machine, dumping it and
adding it to your new database server under a different name.
3 Add a virtual user to DBIx::Password for the old installation.
If installing on the same machine ...
1 Create a new database for the new installation. You cannot use
the same database for both installations.
2 Add a new virtual user to DBIx::Password for the new database,
and update (and flush) MySQL privileges appropriately. You
cannot use the same virtual user for both installations.
3 It is highly recommended that you move /usr/local/slash (or
whatever your installation directory is) to a new location, such
as /usr/local/slash-old, and install a clean slash 2.2
installation. However, this is not necessary to do; you may
install slash 2.2 on top of the slash 2.0 installation.
The reason to not move anything is that you can keep any
customizations done (images, additional scripts and plugins,
static files, etc.). The reason to move it is so that everything
is clean. It is highly recommended that you move it, and then
manually copy back the pieces you want.
4 In any event, either move the old directory, or don't, and then
install slash 2.2 as normal. Do not yet run "install-slashsite".
7. If you have plugins or themes from the old installation to install,
copy them over now. Warning: some plugins and themes might need to
be ported first. You may wish to deal with them later if they are
not yet ported to slash 2.2.
8. Run "install-slashsite". Use the new virtual user.
9. Copy over any files (images, FAQs, etc.) that need to be copied, if
necessary.
10. Run update script, utils/slash2toslash2.2. Read its instructions!
11. Update templates.
12. Doublecheck Apache configs (httpd/slash.conf,
site/sitename/sitename.conf). These configs have changed from the
last version. Read the comments and set them up as desired.
13. Start Apache.
14. Start slashd.
Slash 2.2.x -> Slash 2.2.y
Read all of this section before doing any of it.
The first thing to do is to, as per the instructions below under
INSTALLATION, unpack the latest distribution and run make and make
install with the proper arguments.
Overwriting Changes
This process will overwrite any customizations of your installed
modules, or customizations of the installed scripts in
/usr/local/slash/themes/ and /usr/local/slash/plugins/ (for themes
and plugins that come with Slash). If you ran "install-slashsite"
with the default option of using symlinks, and made customizations
to the originals instead of breaking the symlink and copying the
file over, then this will overwrite your changes.
If you did modify the original instead of a copy, then break the
symlink, copy over the original (as modified), and then continue.
The original will be copied over by the new version, and your
modified copy will remain intact.
Templates
With every update, there are changes to templates. But most people
will modify their templates. A relatively simple way to see what has
changed is to use template-tool and template-check. This procedure
should help most users deal with the integration of new templates
into an existing site (it will only work with the slashcode theme,
but a simple modification to the code of template-check can fix
that).
Dump
Use template-tool to dump your templates into an empty
directory.
% mkdir templates
% cd templates
% template-tool -u VIRTUAL_USER -d
(Defaults to current directory.)
Compare
Use template-check to compare installed templates in
/usr/local/slash/themes/slashcode/ and /usr/local/slash/plugins/
against the templates that have been dumped.
% template-check -u VIRTUAL_USER
(Defaults to current directory.)
This will use diff to show you the differences. You can either
go into the templates with a text editor (in another window) and
change the dumped ones by hand, edit them by hand in the
Template Editor via the web browser, or take a note of every
template you want to copy over your existing template.
After each directory of templates is done, hit "q" to continue
to the next plugin/theme.
Sync
If you made changes by hand via the web, you are done.
Otherwise, take the list of templates to update, and pass the
full filenames to template-tool (this will either be the
templates you modified by hand in the dump directory, or the
unmodified ones in the installation directories). You might need
to put each filename in quotes because of the ";" character in
the filenames. This will overwrite your existing template with
the new template.
% template-tool -u VIRTUAL_USER -s LIST
Slash 2.2.6 -> Slash CVS
Use the sql/mysql/upgrades file; see "VERSIONS", "CVS tags", below. This
file is human-readable and very long. You can upgrade a 2.2.6 to the
latest CVS by methodically applying every step in this file, but it is
tedious and requires an engaged human brain reading the comments (i.e.,
don't "mysql slash < upgrades", that will fail miserably).
Slash CVS -> later Slash CVS
Again, use the sql/mysql/upgrades file (and the caveat just mentioned
still applies). Start from the CVS tag you left off at, and proceed to
the CVS tag you upgraded to (which should be the end of the file). If
you're not sure which tag you left off at, you might check the var
'cvs_tag_currentcode', which will contain the right value if you last
updated after September 2005.
In general, you should stop apache and slashd, do a "make install",
apply the upgrades file a line at a time for each Slash site, run
"template-tool -U -u virtusename" and "symlink-tool -U -u virtusername"
for each Slash site, and then start slashd and apache back up.
REQUIREMENTS
Software Requirements
Below, we list the main software components needed. The recommended
version is given. Usually this is the version we have done extensive
testing on, typically a version we have used on Slashdot for some time.
In parentheses we include (but do not recommend or support) the earliest
version we believe could work.
Perl
Version 5.20.00
http://www.cpan.org/
MySQL
Version 5.6
http://www.mysql.com/
Apache
Version 2.2.29
http://httpd.apache.org/
mod_perl
Version 2.08.
http://perl.apache.org/
memcached
Version 1.1.12 (1.1.11).
See "Memcached" above.
Sendmail or other mail transport agent
Refer to your OS distribution.
Perl module distributions
The latest version of each perl module is recommended. To download
and install them, use build-environment -- see "INSTALLATION".
Hardware Requirements
There are no specific hardware requirements.
rehash is designed to work well on multi-machine setups, with one or
more webheads that are separate from one or more MySQL DB machines. But
for low-load sites (1-5 pages/sec or slower), it can probably be run OK
on a single machine.
Apache (with mod_perl) and MySQL both take up a lot of RAM. Running a
complete system with 128MB might be possible, if you do some tuning of
the configuration, but a practical minimum of 1 GiB is recommended, and
you will be much happier with at least 2GB of RAM. See "INSTALLATION
OPTIONS".
VERSIONS
rehash uses time based version stamps, with the major being the year,
and the minor being the month. Point releases are done for bug fixes
related to a specific major.minor pair
For example, rehash version 15.05.4 refers to a release made in 2015, in
May (05), and has had four point releases to stablize or fix major bugs.
TROUBLESHOOTING COMMON INSTALLATION PROBLEMS
Here are some common errors reported by other site administrators.
* Webpages show the error: "The server encountered an internal error
or misconfiguration..."
Check your Apache error logs for a more specific error.
* "Can't locate Slash.pm in @INC..."
One possibility is that you didn't actually "make install" Slash in
step 5, which would be a pretty serious omission.
It's also possible that the apache or slashd process issuing this
error doesn't have permissions to read Slash.pm, or is using a
different version of perl than you expect with a different set of
@INC directories than you expect. Try, at the command line:
which perl
head -1 /opt/rehash-environment/rehash/sbin/slashd
perl -MSlash -le 'print $INC{"Slash.pm"}'
and see if it emits the perl binaries you expect and the location of
Slash.pm that you expect. Check file permissions and see "Multiple
perls installed" below.
* I installed Slash twice and it didn't work.
Did you uninstall before reinstalling? See "UNINSTALLING" below. If
you intend to reinstall with the same database and site name, steps
4 and 7 are not optional.
* "Can't locate MIME/Types.pm in @INC..."
This used to be required only for plugins/Blob and you probably
didn't follow its README after you installed it. Now it's in
Bundle::Slash; try reinstalling Bundle::Slash (and see "Old Version
of Bundle::Slash" above).
* "Can't call method '(whatever)' on an undefined value at..."
Slash can't connect to your database server. (This manifests as the
variable $slashdb being undef. Which method happens to emit this
error depends on which code path first tries to use $slashdb.)
To start troubleshooting this, see "Database authentication issues"
below.
* I created a new author but s/he doesn't show up in authors.pl and
can't post stories.
For performance reasons, Rehash aggressively caches the list of
which users are authors. After you mark a user as an author and
boost their seclev (maybe to 100) in users.pl, go back to the
command line and run the refresh_authors.pl task by hand:
# /opt/rehash-environment/rehash/bin/runtask -u yourvirtuser refresh_authors
Then restart apache and slashd. That user will now be able to post
stories. The authors.pl listing will update some time after the
first story is actually posted.
* "Use of uninitialized value in..."
Just a harmless warning, ignore it. It helps us find errors, but you
don't need to worry about it.
Here are some other common reasons why Slash installations fail.
* Perl module installation troubles.
If you have a unix-like system with CPAN properly installed and no
serious firewall issues, perl module installation will usually go
pretty smoothly. Some modules will have overactive testing code; for
example, if your system lacks "nslookup", some of the net-related
modules may complain and refuse to install themselves even though it
isn't strictly speaking necessary. If you're pretty sure you're a
victim of overactive testing, "force install Foo::Bar" for the
offending module and then try "install Bundle::Slash" again.
If you're having CPAN installation troubles, upgrading to the latest
version will make life easier. Note that you'll want to recompile
mod_perl/Apache after upgrading perl.
* Multiple perls installed.
If you have more than one binary file named "perl", trouble awaits.
It's OK to have a /usr/bin/perl5.00503 even after installing 5.6.1,
say. But if your /usr/bin/perl is a different version from
/usr/local/bin/perl, you may be in for a world of hurt.
* httpd.conf errors.
After you "install-slashsite", you're told that you probably want to
add "Include /opt/rehash-environment/rehash/httpd/slash.conf" to its
httpd.conf. Note that that file Include's your site-specific conf
file at /opt/rehash-environment/rehash/sitename/sitename.conf. One
way or another those site-specific directives have to be processed
by Apache.
Are you doing virtual hosting? Make sure you've set it up correctly.
* Database authentication issues.
For each dynamic page your Rehash site delivers, an Apache httpd
child needs to connect to your MySQL server. There's a chain of
access to get from Apache to MySQL and a number of places where it
can break:
* The Apache child httpd process needs to have read access to your
DBIx/Password.pm module file. That process is probably running
as "nobody:nobody" (or similar). If you don't know where
DBIx/Password.pm was installed, try:
# perl -MDBIx::Password -le 'print $INC{"DBIx/Password.pm"}'
If that fails, it's probably not installed; check also
# locate DBIx/Password.pm | grep perl
Make sure the module is installed and that "nobody:nobody" can
read its .pm file. If you've sharing that file over the network,
did you set up ownership correctly?
* The DBIx/Password.pm file needs to be correctly configured. Open
it up with a text editor and make sure $virtual1 contains an
entry for your Slash virtual user that is correct in every
respect: driver, (MySQL) username, database, password, host, and
connect string. These are the values you typed in when you
installed the module but maybe you made a typo.
If you have only one machine for your whole setup, host can be
"localhost". Otherwise use an IP number.
* Network connectivity.
Can the Apache machine connect to the MySQL machine?
* MySQL permissions.
The username field in your DBIx/Password.pm file refers to a
MySQL user which you set up in step 1 of the Installation
Procedure. Make sure this user has permission to connect to the
Slash site's database you also set up in step 1 (and check it
from the Apache machine over the network too). If you don't
fully understand MySQL permissions, don't guess; start your
reading here:
http://www.mysql.com/documentation/mysql/bychapter/manual_MySQL_
Database_Administration.html#Privilege_system
* Types of Users
Make sure you don't confuse the different types of "users":
* unix system user account -- given in httpd.conf User
directive and in the second field of slash.sites, defaults
to 'nobody' unless you changed it in Step 5;
* DBIx::Password virtual user -- given in httpd.conf
SlashVirtualUser directive and in the first field of
slash.sites, you picked this in Step 4 when you installed
DBIx::Password;
* MySQL user -- given as the DBIx::Password virtual user's
'username' hash value, points to the database user you
picked in Step 1.
If slashd doesn't seem to be working, check its log and make
sure it has permission to write its files. It is probably
running as your Apache user "nobody", and if that user doesn't
have write permission to your web directories and/or .shtml and
.rss files and so on, slashd's current behavior is to log an
error and die. (If you want to make slashd run as a different
unix system user, edit the second field in
"/usr/local/slash/slash.sites".)
If you've doublechecked all this, you're sure you followed the
directions, and it still doesn't work, stop in IRC #dev on
irc.soylentnews.org and ask your question. Someone there may know
the answer.
SECURITY NOTES
Older Slash versions
If you're running Slash, you're on a very old and outdates software
stack with Apache 1.3. Upgrading to rehash is required if you wish
to use modern and supported software such as Apache 2.2 or 2.4.
DBIx::Password
DBIx::Password is essentially a keychain to give access to one or
more databases. The "key" that gives access to your rehash site(s)
is simply the ability to read its file, DBIx/Password.pm. By
default, this file is owned by root, and set world-readable (444),
so any process running on any of your web server or slashd machines
will have full read/write access to your Slash database.
In general, don't allow people you don't trust onto your systems.