Changeset 1579 in genappalpha


Ignore:
Timestamp:
Oct 18, 2018, 2:28:08 AM (4 weeks ago)
Author:
ehb
Message:

RH7 support for install

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sbin/install.pl

    r1486 r1579  
    209209
    210210if ( $os eq 'redhat' ) {
    211     die "only Red Hat Enterprise Linux Server 6.7 and 6.8 are currently supported and this appears to be version $os_release\n$sorry" if $os_release !~ /^6\.(7|8)$/;
     211    die "only Red Hat Enterprise Linux Server 6.7 and 6.8 are currently supported and this appears to be version $os_release\n$sorry" if $os_release !~ /^6\.(7|8)$/ && $os_release !~ /^7\.5/;
    212212}   
    213213
     
    687687}
    688688
    689 # ------ redhat -------
    690 if ( $os eq 'redhat' ) {
     689# ------ redhat 6.x -------
     690
     691if ( $os eq 'redhat' && $os_release =~ /^6\.(2|3|4|5)/ ) {
    691692    # install required modules
    692693
     
    749750    # need imagemagick from source :(
    750751    my $imversion = "ImageMagick-6.9.7-10.tar.xz";
    751     runcmd( "rm -f /tmp/$imversion 2>/dev/null;cd /tmp && wget http://transloadit.imagemagick.org/download/releases/$imversion && tar Jxf $imversion && cd ImageMagick-* && ./configure && make -j$CPUS && sudo make install" ) if !-e "/usr/local/bin/MagickWand-config";
     752    runcmd( "rm -fr /tmp/$imversion 2>/dev/null;cd /tmp && wget http://transloadit.imagemagick.org/download/releases/$imversion && tar Jxf $imversion && cd ImageMagick-* && ./configure && make -j$CPUS && sudo make install" ) if !-e "/usr/local/bin/MagickWand-config";
    752753
    753754    my $rhsclphp    = "/opt/rh/rh-php56/root";
     
    10861087        # need imagemagick from source :(
    10871088        my $imversion = "ImageMagick-6.9.7-10.tar.xz";
    1088         runcmd( "rm -f /tmp/$imversion 2>/dev/null; cd /tmp && wget http://transloadit.imagemagick.org/download/releases/$imversion && tar Jxf $imversion && cd ImageMagick-* && ./configure && make -j$CPUS && sudo make install" ) if !-e "/usr/local/bin/MagickWand-config";
     1089        runcmd( "rm -fr /tmp/$imversion 2>/dev/null; cd /tmp && wget http://transloadit.imagemagick.org/download/releases/$imversion && tar Jxf $imversion && cd ImageMagick-* && ./configure && make -j$CPUS && sudo make install" ) if !-e "/usr/local/bin/MagickWand-config";
    10891090    } else {
    10901091        runcmdsb( "yum -y install ImageMagick ImageMagick-devel" );
     
    12031204}
    12041205
     1206# ------ redhat 7.x -------
     1207
     1208if ( $os eq 'redhat' && $os_release =~ /^7\.5/ ) {
     1209    # install required modules
     1210
     1211    runcmdsb( "cat <<_EOF > /etc/yum.repos.d/mongodb.repo
     1212[mongodb]
     1213name=MongoDB Repository
     1214baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64/
     1215gpgcheck=0
     1216enabled=1
     1217_EOF
     1218# the 3.2 repo didn't seem to work
     1219cat <<_EOF > /etc/yum.repos.d/mongodb-org-3.6.repo
     1220[mongodb-org-3.6]
     1221name=MongoDB Repository
     1222baseurl=https://repo.mongodb.org/yum/redhat/\$releasever/mongodb-org/3.6/x86_64/
     1223gpgcheck=1
     1224enabled=1
     1225gpgkey=https://www.mongodb.org/static/pgp/server-3.6.asc
     1226_EOF
     1227# semanage port -a -t mongod_port_t -p tcp 27017
     1228");
     1229
     1230
     1231    runcmdsb( "yum-config-manager --enable rhel-server-rhscl-7-rpms" );
     1232    {
     1233        my @res = `sudo subscription-manager list --available --all 2>&1 | grep 'not yet registered'`;
     1234        die "$0: could not enable rhel-server-rhscl-7-rpms, the system does not appear to be registered. Try \$ sudo subscription-manager register --help" if @res;
     1235        @res = `sudo yum repolist 2> /dev/null | grep rhscl`;
     1236        die '-'x80 . "
     1237$0: you appeared to be registered, but need to attach to a pool.  you can use:
     1238\$ sudo subscription-manager list --available
     1239and identify a 'Pool ID:'=pool_id and then use that pool_id to
     1240\$ sudo subscription-manager attach --pool=pool_id
     1241" . '-'x80 . "
     1242You may also find info at this url:
     1243https://access.redhat.com/documentation/en-US/Red_Hat_Software_Collections/2/html-single/2.1_Release_Notes/index.html#sect-Installation-Subscribe
     1244" . '-'x80 . "
     1245" if !@res;
     1246    }
     1247
     1248    runcmdsb( "yum -y install mlocate git httpd24-httpd httpd24-httpd-devel rh-php56-php rh-php56-php-devel rh-php56-php-pear rh-php56-php-pecl-mongo mongodb-org mongodb-org-server wget libuuid-devel openssl-devel libpng-devel libjpeg-devel fontconfig-devel freetype-devel fftw-devel libtiff-devel cairo-devel pango pango-devel" );
     1249
     1250    # need zeromq from source :(
     1251
     1252    runcmd( "rm -fr /tmp/libzmq 2>/dev/null; cd /tmp && git clone git://github.com/zeromq/libzmq.git && cd libzmq && ./autogen.sh && ./configure && make -j$CPUS && make -j$CPUS check && sudo make -j$CPUS install && cat <<_EOF > /etc/ld.so.conf.d/zeromq.conf
     1253/usr/local/lib
     1254_EOF
     1255sudo ldconfig
     1256 " ) if !-e "/usr/local/lib/libzmq.so" || !-e "/etc/ld.so.conf.d/zeromq.conf";
     1257
     1258    # need imagemagick from source :(
     1259    my $imversion = "ImageMagick-6.9.7-10.tar.xz";
     1260    runcmd( "rm -fr /tmp/$imversion 2>/dev/null;cd /tmp && wget http://transloadit.imagemagick.org/download/releases/$imversion && tar Jxf $imversion && cd ImageMagick-* && ./configure && make -j$CPUS && sudo make install" ) if !-e "/usr/local/bin/MagickWand-config";
     1261
     1262    my $rhsclphp    = "/opt/rh/rh-php56/root";
     1263    my $rhsclphpetc = "/etc/opt/rh/rh-php56/";
     1264    my $rhsclhttpd  = "/opt/rh/httpd24/root";
     1265
     1266    runcmdsb( "sed -i 's/PHP -C -n -q/PHP -C -q/' $rhsclphp/usr/bin/pecl" );
     1267    runcmdsb( "yes '' | $rhsclphp/usr/bin/pecl channel-update pecl.php.net" );
     1268    runcmdsb( "yes '' | $rhsclphp/usr/bin/pecl install uuid zmq-beta mongo imagick;
     1269cat <<_EOF > $rhsclphpetc/php.d/uuid.ini
     1270; Enable uuid extension module
     1271extension=uuid.so
     1272_EOF
     1273cat <<_EOF > $rhsclphpetc/php.d/zmq.ini
     1274; Enable zmq extension module
     1275extension=zmq.so
     1276_EOF
     1277cat <<_EOF > $rhsclphpetc/php.d/imagick.ini
     1278; Enable imagick extension module
     1279extension=imagick.so
     1280_EOF
     1281#cat <<_EOF > $rhsclphpetc/php.d/mongo.ini
     1282#; Enable mongo extension module
     1283#extension=mongo.so
     1284#_EOF
     1285" );
     1286
     1287    runcmdsb( "scl enable rh-php56 'pear upgrade --force --alldeps http://pear.php.net/get/PEAR-1.10.5'" );
     1288    runcmdsb( "scl enable rh-php56 'pear install --alldeps Mail Mail_Mime Net_SMTP'" );
     1289
     1290    `sudo killall mongod 2> /dev/null`;
     1291    runcmdsb( "service mongod start" );
     1292
     1293    # add proxy support for ws, wss
     1294    runcmdsb( "cat <<_EOF > $rhsclhttpd/etc/httpd/conf.d/wsproxy.conf
     1295# ws proxy pass
     1296# priority=20
     1297ProxyPass /ws2 ws://localhost:$wsport/
     1298ProxyPass /wss2 ws://localhost:$wsport/
     1299_EOF
     1300cat <<_EOF > $rhsclhttpd/etc/httpd/conf.d/genapp.conf
     1301SetEnv GENAPP $gb
     1302_EOF
     1303");
     1304
     1305    runcmdsb( "cat <<_EOF > $rhsclhttpd/etc/httpd/conf.d/noindices.conf
     1306<Directory \"$rhsclhttpd/var/www/html\">
     1307    Options FollowSymLinks
     1308    AllowOverride None
     1309    Require all granted
     1310</Directory>
     1311_EOF
     1312");
     1313
     1314    # scl puts php in $rhsclphp so link it
     1315
     1316    runcmdsb( "ln -sf $rhsclphp/usr/bin/php /usr/bin/php" );
     1317
     1318    # scl puts httpd root in $rhsclphp so link it
     1319
     1320    if ( -e "/var/www" ) {
     1321        if ( -d "/var/www" || -f "/var/www" ) {
     1322            my $bdir = "/var/www.previous";
     1323            my $ext ;
     1324            while ( -e $bdir ) {
     1325               $ext++;
     1326               $bdir = "/var/www.previous-$ext";
     1327            }
     1328            $warnings .= "/var/www is backed up in $bdir";
     1329            runcmdsb( "mv /var/www $bdir" );
     1330        } else {
     1331            runcmdsb( "rm /var/www" );
     1332        }
     1333    }
     1334     
     1335    runcmdsb( "ln -sf $rhsclhttpd/var/www /var/www" );
     1336
     1337    # genapp html5 likes php at /usr/local/bin/php so make sure it exists
     1338
     1339    if ( -e "/usr/bin/php" && !-e "/usr/local/bin/php" ) {
     1340        runcmdsb( "ln -s /usr/bin/php /usr/local/bin/php" );
     1341    }
     1342
     1343    # make the base of the genapp instances directory, create group genapp, add user & apache to genapp group
     1344
     1345    runcmdsb( "mkdir -p $appbase
     1346groupadd genapp
     1347useradd genapp -r -s /usr/sbin/nologin -d $appbase -g genapp
     1348chmod g+rwx $appbase
     1349chown $whoami:genapp $appbase
     1350chmod g+s $appbase
     1351mkdir $$cfgjson{'lockdir'}
     1352chown genapp:genapp $$cfgjson{'lockdir'}
     1353chmod g+rwx $$cfgjson{'lockdir'}
     1354usermod -g users -G genapp $whoami
     1355usermod -G genapp \'apache\'
     1356chgrp -R genapp $gb
     1357chmod g+w $gb/etc
     1358" );
     1359
     1360    # setup local system definitions
     1361
     1362    runcmdsb( "cat <<_EOF > /etc/profile.d/genapp.sh
     1363export GENAPP=$gb
     1364export PATH=\\\\\\\$GENAPP/bin:\\\\\\\$PATH
     1365_EOF
     1366cat <<_EOF > /etc/profile.d/genapp.csh
     1367setenv GENAPP $gb
     1368setenv PATH=\\\\\\\$\{GENAPP\}/bin:\\\\\\\$\{PATH}
     1369_EOF
     1370
     1371" );
     1372
     1373    runcmdsb( "cat <<_EOF > $$cfgjson{'webroot'}/php_info.php
     1374<?php
     1375phpinfo();
     1376?>
     1377_EOF
     1378" );
     1379
     1380    # setup genapptest instance
     1381
     1382    runcmd( "cd $appbase && $gb/sbin/getapp.pl -force -gen -admin $whoami svn genapptest" );
     1383
     1384    # add ws servers to startup
     1385
     1386    runcmdsb( "cp $appbase/genapptest/output/html5/util/rc.genapp /etc/init.d" );
     1387    runcmdsb( "chkconfig --add rc.genapp" );
     1388    runcmdsb( "/etc/init.d/rc.genapp start" );
     1389
     1390    runcmdsb( "semanage permissive -a httpd_t; service httpd24-httpd restart && chkconfig httpd24-httpd on" );
     1391
     1392    {
     1393        my $iptab = `service iptables status | grep ACCEPT | grep INPUT | grep dpt:80`;
     1394        chomp $iptab;
     1395        if ( $iptab !~ /tcp/ ) {
     1396            runcmdsb( "iptables -I INPUT 1 -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
     1397service iptables save" );
     1398        }
     1399    }
     1400    if ( $$cfgjson{ 'https' } ) {
     1401        my $iptab = `service iptables status | grep ACCEPT | grep INPUT | grep dpt:443`;
     1402        chomp $iptab;
     1403        if ( $iptab !~ /tcp/ ) {
     1404            runcmdsb( "iptables -I INPUT 1 -m state --state NEW -m tcp -p tcp --dport 443 -j ACCEPT
     1405service iptables save" );
     1406        }
     1407    }
     1408
     1409#    runcmdsb( "service httpd restart && chkconfig httpd on" );
     1410    exit();
     1411}
     1412
    12051413
    12061414die "------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.