install

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
install [2020/04/04 17:48] – updating Mac install instructions for new version for AMPPS wikimaininstall [2021/11/08 21:53] (current) zhangster
Line 178: Line 178:
 **1) Install LAMP Server** **1) Install LAMP Server**
 > sudo apt-get update > sudo apt-get update
-> sudo apt-get install lamp-server^ git+> sudo apt-get install lamp-server^ git php-gd php-mbstring php-xml
 When prompted whether or not to install, hit 'y' and press enter. Remember the root password you enter when installing the MySQL server. You will need this password later. When prompted whether or not to install, hit 'y' and press enter. Remember the root password you enter when installing the MySQL server. You will need this password later.
  
Line 247: Line 247:
  
 > ~/admin/migrate > ~/admin/migrate
 +
 +-----
 +
 +====Update an EgoWeb 2.0 to the new framework, version 2.0.10==== 
 +
 +EgoWeb 2.0.10 is a major update with improved security and UX features. These include the following updated libraries:
 +
 +Yii Framework 2.0
 +Bootstrap 4.0
 +jQuery 3.4
 +
 +The Authoring section was also updating using VueJS to streamline editing and administrating studies. 
 +
 +Before updating:
 +
 +**1) Make sure your database migrations are up to date.  You can trigger this by going to https://[your-server-domain]/admin/migrate in your browser.**
 +
 +**2) Make a backup of your database.  This can be done by exporting the entire database in PhpMyAdmin.**
 +
 +**3) Make a copy of  protected/config/main.php on your current server.   Rename "main.php" to "main.php.backup"**
 +
 +Updating process:
 +
 +**1) Download the latest version from the new_framework branch of the EgoWeb github located [[https://github.com/qualintitative/egoweb/tree/new_framework|here]]. **
 +
 +
 +
 +**2) On linux, run the command "rsync -avz app/ /var/www/html/" from the github repo folder.  OR, copy the contents of the app folder to the root folder of your current server.**
 +
 +**3) Run the script ./initialize.sh, OR manually make a copy of main.php.example and name it main.php.**
 +
 +**4) Update config files**
 +
 +In main.php.backup, find the securityManager section, and copy the value for "encryptionKey".
 +
 +        'securityManager' => array(
 +            'cryptAlgorithm' => 'rijndael-128',
 +            'encryptionKey' => 'oldencryptionkey',
 +        )
 +
 +Open the new main.php and look for the params section towards the end of the file.  replace  the value 'old_key1old_key1' with the encryptionKey value  from your old config, like so:
 +
 +    'params' => [
 +        'version'=>'2.0.10.0',
 + // this is used in contact page
 + 'adminEmail' => 'admin@egoweb.com',
 + // The max login attempt before showing captcha
 + 'maxLoginAttempts' => 3,
 + 'maxUploadFileSize' => 1024 * 1024 * 3, // 3MB // file path for study export
 + 'exportFilePath' => '',
 + // Enabling audio upload may make your server less secure
 + 'enableAudioUpload' => false,
 +        'surveyURL' => 'http://'.$_SERVER['HTTP_HOST'].'/survey',
 +        'APIPassword' => 'yourpasswordhere',
 +        'encryptionKey' => 'oldencryptionkey',
 +        'user.passwordResetTokenExpire' => 3600,
 +        'user.passwordMinLength' => 8,
 +    ],
 +
 +on some servers this might be 'old_key1old_key1', in which case it doesn't need to be changed.  However, it is strongly recommend that you create a unique encryption key for your server.   if you wish to change the encryption key, you will need to export yall our studies, along with interview data, in the Import / Export section prior to updating Egoweb, change the encryption key, then re-import your study files.  This will re-encrypt your data using the new key.
 +
 +2.  Update the database username and password.  Look for the following section in  main.php.backup
 +
 +        'db' => array(
 +            'connectionString' => 'mysql:host=localhost;dbname=egoweb',
 +            'username' => 'new_egowebuser',
 +            'password' => "new_egowebpass",
 +            //'enableProfiling'=>true,
 +            'emulatePrepare' => true,
 +            'charset' => 'utf8',
 +        ),
 +
 +use the values above to replace the username and password values tin the "db" section in the new main.php:
 +
 +        'db' => [
 +            'class' => 'yii\db\Connection',
 +            'dsn' => 'mysql:host=localhost;dbname=egoweb',
 +            'username' => 'new_egowebuser',
 +            'password' => 'new_egowebuser',
 +            'charset' => 'utf8',
 +        ],
 +
 +On some servers use the default password egowebuser and egowebpass.  we recommend creating a unique username and password for the egoweb database in your mysql server.  this can be done by creating a new user and granting them access to the egoweb database, then editing the database username and password in the main.php config file.  this may or may not be required depending on your organization's security policy, though not necessary for servers on personal computers.
 +
 +**5) Create new user accounts**
 +
 +Passwords are encrypted differently in EgoWeb 2.0.10.  You will need to reset your password in order to be able to login.  There are two ways to address this issue:  
 +    1. Use the new password reset feature.  This will only work if you have a mail service such as sendmail or postfix installed on your server, as it will attempt to send a password reset email to the user email.
 +    2. Delete all the users in the user table in the database.  Afterwards, going to the EgoWeb homepage will bring up a Create New Admin User form.  If there were multiple users who are not Super Admins who have authored studies, those studies will  no longer be accessible by non-Super Admins unless the study table is updated with the user ids of newly created users.
 +
 +===Update a server running the new framework==
 +
 +This set of instructions assumes you are running EgoWeb 2.0 to the new framework, version 2.0.10, and that there is a copy of egoweb in the ~/ folder.  (You may need to install rsync if not installed already with the following command: > apt-get install rsync)
 +
 +After logging in, type these following commands:
 +
 +> cd egoweb
 +> git pull
 +> rsync -avz app/ /var/www/html/
 +
 +After these commands are successfully run, open a browser and log in to the version of EgoWeb 2.0 just updated. Go to the following URL extension of the EgoWeb 2.0 URL that is being updated:
 +
 +> ~admin/migrate
 +
 +If there are database changes, these will be migrated into the existing data base and EgoWeb 2.0 will be fully updated.
 +
 +
  
 ----- -----
 ====Creating a new Linux server with www.linode.com====  ====Creating a new Linux server with www.linode.com==== 
  
-The script below is available in the [[http://www.linode.com|www.linode.com]] stack script library. This [[https://www.linode.com/docs/platform/stackscripts|StackScript]] installs EgoWeb 2.0 and all software required to run on Linode. Most of the code should work on other systems. The Current Distribution is set to Ubuntu 14.04 LTS.+The script below is available in the [[http://www.linode.com|www.linode.com]] stack script library. This [[https://www.linode.com/docs/platform/stackscripts|StackScript]] installs EgoWeb 2.0 and all software required to run on Linode. Most of the code should work on other systems. It was run in April 2020 by Scot Hickey (I have not run it myself) and he sent me the script and I pasted it here and created the stack script in Linode.  I have not run it there.   
 + 
 +Here are some notes provided by a project coordinator who set up an EgoWeb VM in 3/2020.  The notes are based on reading the old instructions, so some of the stack script might have addressed what he noticed that was outdated.  
 + 
 +1. Ubuntu 14.10 is very old, and most are using later distros (18.04, 20.04). Because of this some of the commands are out of date (sudo apt-get is now sudo apt). While apt-get still works, it’s outdated.  
 +2. PHP latest release is 8.0.3, and therefore using phpenmod rather than php5enmod.  
 +3. Mcrypt is not supported by default in PHP anymore (as of 7.1), so there were some extra steps I had to go through. Here is a good guide that should work: https://php.tutorials24x7.com/blog/how-to-install-mcrypt-for-php-7-on-ubuntu-20-04-lts 
 +4. For those who aren’t super technically skilled, I would suggest that the step to replace the egowebpass in the config file should be it’s own step. 
 +5. It might be helpful to your users to include a section on configuring apache for a custom domain / SSL. 
 + 
 +Below is the stack script: 
 + 
 +#!/bin/bash -e 
 + 
 +exec > >(tee -i /var/log/stackscript.log) 
 + 
 +# <UDF name="DB_PASSWORD" Label="Root password for mysql" example="Password for administrative access to mysql." /> 
 + 
 +DB_NAME="egoweb" 
 +DB_USER="egowebuser" 
 +DB_USER_PASSWORD="egowebpass" 
 + 
 +echo "db_password is $DB_PASSWORD" 
 +echo "db_name is $DB_NAME" 
 +echo "db_user is $DB_USER" 
 +echo "db_user_password is $DB_USER_PASSWORD" 
 + 
 +############################################## 
 +# FUNCTIONS (SOMETIMES) USED DURING SETUP 
 +############################################## 
 + 
 +function system_update() { 
 +   sudo apt-get update 
 +    sudo dpkg --configure -a 
 +    sudo apt-get -y install  
 +    # aptitude -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" full-upgrade 
 +
 + 
 +function system_primary_ip() { 
 +    # returns the primary IP assigned to eth0 
 +    echo $(ifconfig eth0 | awk -F: '/inet addr:/ {print $2}' | awk '{ print $1 }') 
 +
 + 
 +function get_rdns() { 
 +    # calls host on an IP address and returns its reverse dns 
 +    if [ ! -e /usr/bin/host ]; then 
 +        aptitude -y install dnsutils > /dev/null 
 +    fi 
 +    echo $(host $1 | awk '/pointer/ {print $5}' | sed 's/\.$//'
 +
 + 
 +function get_rdns_primary_ip() { 
 +    # returns the reverse dns of the primary IP assigned to this system 
 +    echo $(get_rdns $(system_primary_ip)) 
 +
 + 
 +function system_set_hostname() { 
 +    # $1 - The hostname to define 
 +    HOSTNAME="$1" 
 +    if [ ! -n "$HOSTNAME" ]; then 
 +        echo "Hostname undefined" 
 +        return 1; 
 +    fi 
 +    echo "$HOSTNAME" > /etc/hostname 
 +    hostname -F /etc/hostname 
 +
 + 
 +function system_add_host_entry() { 
 +    # $1 - The IP address to set a hosts entry for 
 +    # $2 - The FQDN to set to the IP 
 +    IPADDR="$1" 
 +    FQDN="$2" 
 +    if [ -z "$IPADDR" -o -z "$FQDN" ]; then 
 +        echo "IP address and/or FQDN Undefined" 
 +        return 1; 
 +    fi 
 +    echo $IPADDR $FQDN  >> /etc/hosts 
 +
 + 
 +########################################################### 
 +# Users and Authentication 
 +########################################################### 
 + 
 +function user_add_sudo() { 
 +    # Installs sudo if needed and creates a user in the sudo group. 
 +    # 
 +    # $1 - Required - username 
 +    # $2 - Required - password 
 +    USERNAME="$1" 
 +    USERPASS="$2" 
 +    if [ ! -n "$USERNAME" ] || [ ! -n "$USERPASS" ]; then 
 +        echo "No new username and/or password entered" 
 +        return 1; 
 +    fi 
 + 
 +    aptitude -y install sudo 
 +    adduser $USERNAME --disabled-password --gecos "" 
 +    echo "$USERNAME:$USERPASS" | chpasswd 
 +    usermod -aG sudo $USERNAME 
 +
 + 
 +function user_add_pubkey() { 
 +    # Adds the users public key to authorized_keys for the specified user. Make sure you wrap your input variables in double quotes, or the key may not load properly. 
 +    # 
 +    # 
 +    # $1 - Required - username 
 +    # $2 - Required - public key 
 +    USERNAME="$1" 
 +    USERPUBKEY="$2" 
 +    if [ ! -n "$USERNAME" ] || [ ! -n "$USERPUBKEY" ]; then 
 +        echo "Must provide a username and the location of a pubkey" 
 +        return 1; 
 +    fi 
 +    if [ "$USERNAME" == "root" ]; then 
 +        mkdir /root/.ssh 
 +        echo "$USERPUBKEY" >> /root/.ssh/authorized_keys 
 +        return 1; 
 +    fi 
 +    mkdir -p /home/$USERNAME/.ssh 
 +    echo "$USERPUBKEY" >> /home/$USERNAME/.ssh/authorized_keys 
 +    chown -R "$USERNAME":"$USERNAME" /home/$USERNAME/.ssh 
 +
 + 
 +function ssh_disable_root() { 
 +    # Disables root SSH access. 
 +    sed -i 's/PermitRootLogin yes/PermitRootLogin no/' /etc/ssh/sshd_config 
 +    touch /tmp/restart-ssh 
 +
 + 
 +########################################################### 
 +# Postfix 
 +########################################################### 
 + 
 +function postfix_install_loopback_only() { 
 +    # Installs postfix and configure to listen only on the local interface. Also 
 +    # allows for local mail delivery 
 +    echo "postfix postfix/main_mailer_type select Internet Site" | debconf-set-selections 
 +    echo "postfix postfix/mailname string localhost" | debconf-set-selections 
 +    echo "postfix postfix/destinations string localhost.localdomain, localhost" | debconf-set-selections 
 +    aptitude -y install postfix 
 +    /usr/sbin/postconf -e "inet_interfaces = loopback-only" 
 +    #/usr/sbin/postconf -e "local_transport = error:local delivery is disabled" 
 +    touch /tmp/restart-postfix 
 +
 + 
 +########################################################### 
 +# Apache 
 +########################################################### 
 + 
 +function apache_install() { 
 +    # installs the system default apache2 MPM 
 +    aptitude -y install apache2 
 +    a2dissite default # disable the interfering default virtualhost 
 +    # clean up, or add the NameVirtualHost line to ports.conf 
 +    sed -i -e 's/^NameVirtualHost \*$/NameVirtualHost *:80/' /etc/apache2/ports.conf 
 +    if ! grep -q NameVirtualHost /etc/apache2/ports.conf; then 
 +        echo 'NameVirtualHost *:80' > /etc/apache2/ports.conf.tmp 
 +        cat /etc/apache2/ports.conf >> /etc/apache2/ports.conf.tmp 
 +        mv -f /etc/apache2/ports.conf.tmp /etc/apache2/ports.conf 
 +    fi 
 +
 + 
 +function apache_tune() { 
 +    # Tunes Apache's memory to use the percentage of RAM you specify, defaulting to 40% 
 +    # $1 - the percent of system memory to allocate towards Apache 
 +    if [ ! -n "$1" ]; 
 +        then PERCENT=40 
 +        else PERCENT="$1" 
 +    fi 
 +    # aptitude -y install apache2-mpm-prefork 
 +    PERPROCMEM=10 # the amount of memory in MB each apache process is likely to utilize 
 +    MEM=$(grep MemTotal /proc/meminfo | awk '{ print int($2/1024) }') # how much memory in MB this system has 
 +    MAXCLIENTS=$((MEM*PERCENT/100/PERPROCMEM)) # calculate MaxClients 
 +    MAXCLIENTS=${MAXCLIENTS/.*} # cast to an integer 
 +    sed -i -e "s/\(^[ \t]*MaxClients[ \t]*\)[0-9]*/\1$MAXCLIENTS/" /etc/apache2/apache2.conf 
 +    touch /tmp/restart-apache2 
 +
 + 
 +function apache_virtualhost() { 
 +    # Configures a VirtualHost 
 +    # $1 - required - the hostname of the virtualhost to create  
 +    if [ ! -n "$1" ]; then 
 +        echo "apache_virtualhost() requires the hostname as the first argument" 
 +        return 1; 
 +    fi 
 + 
 +    if [ -e "/etc/apache2/sites-available/$1" ]; then 
 +        echo /etc/apache2/sites-available/$1 already exists 
 +        return; 
 +    fi 
 +    mkdir -p /srv/www/$1/public_html /srv/www/$1/logs 
 +    echo "<VirtualHost *:80>" > /etc/apache2/sites-available/$1 
 +    echo "    ServerName $1" >> /etc/apache2/sites-available/$1 
 +    echo "    DocumentRoot /srv/www/$1/public_html/" >> /etc/apache2/sites-available/$1 
 +    echo "    ErrorLog /srv/www/$1/logs/error.log" >> /etc/apache2/sites-available/$1 
 +    echo "    CustomLog /srv/www/$1/logs/access.log combined" >> /etc/apache2/sites-available/$1 
 +    echo "</VirtualHost>" >> /etc/apache2/sites-available/$1 
 +    a2ensite $1 
 +    touch /tmp/restart-apache2 
 +
 + 
 +function apache_virtualhost_from_rdns() { 
 +    # Configures a VirtualHost using the rdns of the first IP as the ServerName 
 +    apache_virtualhost $(get_rdns_primary_ip) 
 +
 + 
 +function apache_virtualhost_get_docroot() { 
 +    if [ ! -n "$1" ]; then 
 +        echo "apache_virtualhost_get_docroot() requires the hostname as the first argument" 
 +        return 1; 
 +    fi 
 +    if [ -e /etc/apache2/sites-available/$1 ]; 
 +        then echo $(awk '/DocumentRoot/ {print $2}' /etc/apache2/sites-available/$1 ) 
 +    fi 
 +
 + 
 +########################################################### 
 +# mysql-server 
 +########################################################### 
 + 
 +function mysql_install() { 
 +    # $1 - the mysql root password 
 +    echo "mysql root pass is  $1" 
 +    if [ ! -n "$1" ]; then 
 +        echo "mysql_install() requires the root pass as its first argument" 
 +        return 1; 
 +    fi 
 +    echo "mysql-server mysql-server/root_password password $1" | debconf-set-selections 
 +    echo "mysql-server mysql-server/root_password_again password $1" | debconf-set-selections 
 +    apt-get -y install mysql-server mysql-client 
 +    echo "Sleeping while MySQL starts up for the first time..." 
 +    sleep 5 
 +
 + 
 +function mysql_tune() { 
 +    # Tunes MySQL's memory usage to utilize the percentage of memory you specify, defaulting to 40% 
 +    # $1 - the percent of system memory to allocate towards MySQL 
 +    if [ ! -n "$1" ]; 
 +        then PERCENT=40 
 +        else PERCENT="$1" 
 +    fi 
 +    sed -i -e 's/^#skip-innodb/skip-innodb/' /etc/mysql/my.cnf # disable innodb - saves about 100M 
 +    MEM=$(awk '/MemTotal/ {print int($2/1024)}' /proc/meminfo) # how much memory in MB this system has 
 +    MYMEM=$((MEM*PERCENT/100)) # how much memory we'd like to tune mysql with 
 +    MYMEMCHUNKS=$((MYMEM/4)) # how many 4MB chunks we have to play with 
 +    # mysql config options we want to set to the percentages in the second list, respectively 
 +    OPTLIST=(key_buffer sort_buffer_size read_buffer_size read_rnd_buffer_size myisam_sort_buffer_size query_cache_size) 
 +    DISTLIST=(75 1 1 1 5 15) 
 +    for opt in ${OPTLIST[@]}; do 
 +        sed -i -e "/\[mysqld\]/,/\[.*\]/s/^$opt/#$opt/" /etc/mysql/my.cnf 
 +    done 
 +    for i in ${!OPTLIST[*]}; do 
 +        val=$(echo | awk "{print int((${DISTLIST[$i]} * $MYMEMCHUNKS/100))*4}"
 +        if [ $val -lt 4 ] 
 +            then val=4 
 +        fi 
 +        config="${config}\n${OPTLIST[$i]} = ${val}M" 
 +    done 
 +    sed -i -e "s/\(\[mysqld\]\)/\1\n$config\n/" /etc/mysql/my.cnf 
 +    touch /tmp/restart-mysql 
 +
 + 
 +function mysql_create_database() { 
 +    # $1 - the mysql root password 
 +    # $2 - the db name to create 
 +    if [ ! -n "$1" ]; then 
 +        echo "mysql_create_database() requires the root pass as its first argument" 
 +        return 1; 
 +    fi 
 +    if [ ! -n "$2" ]; then 
 +        echo "mysql_create_database() requires the name of the database as the second argument" 
 +        return 1; 
 +    fi 
 +    echo "CREATE DATABASE $2;" | mysql -u root -p$1 
 +
 + 
 +function mysql_create_user() { 
 +    # $1 - the mysql root password 
 +    # $2 - the user to create 
 +    # $3 - their password 
 +    if [ ! -n "$1" ]; then 
 +        echo "mysql_create_user() requires the root pass as its first argument" 
 +        return 1; 
 +    fi 
 + 
 +    if [ ! -n "$2" ]; then 
 +        echo "mysql_create_user() requires username as the second argument" 
 +        return 1; 
 +    fi 
 +    if [ ! -n "$3" ]; then 
 +        echo "mysql_create_user() requires a password as the third argument" 
 +        return 1; 
 +    fi 
 +    echo "CREATE USER '$2'@'localhost' IDENTIFIED BY '$3';" | mysql -u root -p$1 
 +
 + 
 +function mysql_grant_user() { 
 +    # $1 - the mysql root password 
 +    # $2 - the user to bestow privileges  
 +    # $3 - the database 
 +    if [ ! -n "$1" ]; then 
 +        echo "mysql_create_user() requires the root pass as its first argument" 
 +        return 1; 
 +    fi 
 + 
 +    if [ ! -n "$2" ]; then 
 +        echo "mysql_create_user() requires username as the second argument" 
 +        return 1; 
 +    fi 
 + 
 +    if [ ! -n "$3" ]; then 
 +        echo "mysql_create_user() requires a database as the third argument" 
 +        return 1; 
 +    fi 
 +    echo "GRANT ALL PRIVILEGES ON $3.* TO '$2'@'localhost';" | mysql -u root -p$1 
 +    echo "FLUSH PRIVILEGES;" | mysql -u root -p$1 
 +
 + 
 +########################################################### 
 +# PHP functions 
 +########################################################### 
 + 
 +function php_install_with_apache() { 
 +    aptitude -y install php php-mysql libapache2-mod-php 
 +    touch /tmp/restart-apache2 
 +
 + 
 +function php_tune() { 
 +    # Tunes PHP to utilize up to 32M per process 
 +    iniloc=$(php --ini | grep Loaded | cut -d" " -f12) 
 +    # echo "iniloc is $iniloc" 
 +    sed -i'-orig' 's/memory_limit = [0-9]\+M/memory_limit = 32M/' $iniloc 
 +    touch /tmp/restart-apache2 
 +
 + 
 +function php_fixtimeout() { 
 +    iniloc=$(php --ini | grep Loaded | cut -d" " -f12) 
 +   echo "iniloc is $iniloc" 
 +   sed -i 's/max_input_vars = [0-9]/max_input_vars = 10000/' $iniloc 
 +   sed -i 's/max_execution_time = [0-9]/max_execution_time = 5000/' $iniloc 
 +    sed -i 's/post_max_size = [0-9]\+M/post_max_size = 1900M/' $iniloc 
 +    sed -i 's/upload_max_filesize = [0-9]\+M/upload_max_filesize = 2000M/' $iniloc 
 +    sed -i 's/memory_limit = [0-9]\+M/memory_limit = 3072M/' $iniloc 
 +    sed -i 's/max_file_uploads = [0-9]/max_file_uploads = 5000/' $iniloc 
 + 
 +    touch /tmp/restart-apache2 
 +
 + 
 +function php_fixtimeouta() { 
 +    iniloc=$(sudo find /etc/ -name php.ini | grep 'apache2'
 +   echo "iniloc is $iniloc" 
 +   sed -i 's/max_input_vars = [0-9]/max_input_vars = 10000/' $iniloc 
 +   sed -i 's/max_execution_time = [0-9]/max_execution_time = 5000/' $iniloc 
 +    sed -i 's/post_max_size = [0-9]\+M/post_max_size = 1900M/' $iniloc 
 +    sed -i 's/upload_max_filesize = [0-9]\+M/upload_max_filesize = 2000M/' $iniloc 
 +    sed -i 's/memory_limit = [0-9]\+M/memory_limit = 3072M/' $iniloc 
 +    sed -i 's/max_file_uploads = [0-9]/max_file_uploads = 5000/' $iniloc 
 + 
 +    touch /tmp/restart-apache2 
 + 
 +
 + 
 +########################################################### 
 +# Other niceties! 
 +########################################################### 
 + 
 +function goodstuff() { 
 +    # Installs the REAL vim, wget, less, and enables color root prompt and the "ll" list long alias 
 +    aptitude -y install wget vim less 
 +    sed -i -e 's/^#PS1=/PS1=/' /root/.bashrc # enable the colorful root bash prompt 
 +    sed -i -e "s/^#alias ll='ls -l'/alias ll='ls -al'/" /root/.bashrc # enable ll list long alias <3 
 +
 + 
 +########################################################### 
 +# utility functions 
 +########################################################### 
 + 
 +function restartServices() { 
 +    # restarts services that have a file in /tmp/needs-restart/ 
 +    for service in $(ls /tmp/restart-* | cut -d- -f2-10); do 
 +        /etc/init.d/$service restart 
 +        rm -f /tmp/restart-$service 
 +    done 
 +
 + 
 +function randomString { 
 +    if [ ! -n "$1" ]; 
 +        then LEN=20 
 +        else LEN="$1" 
 +    fi 
 +    echo $(</dev/urandom tr -dc A-Za-z0-9 | head -c $LEN) # generate a random string 
 +
 + 
 +export DEBIAN_FRONTEND=noninteractive 
 +echo "Updating OS" 
 +sudo apt-get update 
 +sudo apt-get -y install aptitude 
 + 
 +echo "Installing MySQL" 
 + mysql_install "$DB_PASSWORD" 
 + mysql_tune 40 
 + mysql_create_database "$DB_PASSWORD" "$DB_NAME" 
 + mysql_create_user "$DB_PASSWORD" "$DB_USER" "$DB_USER_PASSWORD" 
 + mysql_grant_user "$DB_PASSWORD" "$DB_USER" "$DB_NAME" 
 +echo "Installing PHP and Apache" 
 +php_install_with_apache 
 +sudo apt-get -y install php-mbstring 
 +sudo apt-get -y install php-xml 
 +sudo apt-get -y install php-gd 
 +sudo apt-get -y install php-imagick 
 + apache_install && apache_tune 40 
 + goodstuff 
 +php_tune 
 +php_fixtimeout 
 +php_fixtimeouta 
 + 
 +restartServices 
 + 
 +a2enmod rewrite 
 + 
 +sudo apt-get install -y git 
 +echo 'CLONING EGOWEB FROM GIT' 
 +git clone https://github.com/qualintitative/egoweb --branch dev 
 +echo 'REMOVING DEFAULT WEB FILES' 
 +sudo rm -rf /var/www/
 +echo 'ADDING EGOWEB FILES TO WEB DIRECTORY' 
 +sudo cp -r egoweb/app/. /var/www/html/ 
 +echo 'SETTING UP TABLES IN MYSQL FOR EGOWEB - USE SQL FILE AS SOURCE' 
 +# echo "source /egoweb/sql/egoweb_db.sql" | mysql egoweb -u root -p$DB_PASSWORD 
 +mysql egoweb -u root -p$DB_PASSWORD < /egoweb/sql/egoweb_db.sql  
 +ELINENOF=$(grep -n '/var/www/' /etc/apache2/apache2.conf |cut -f1 -d:) 
 +ELINENO=$(($ELINENOF + 2)) 
 +echo "$ELINENO s/None/All/" 
 +sed -i -e "$ELINENO s/None/All/" /etc/apache2/apache2.conf 
 + 
 +restartServices 
 + 
 +cd /var/www/html 
 + 
 +./initialize.sh
  
-> #!/bin/bash 
-> set -e 
-> # <UDF name="db_password" Label="MySQL root Password" /> 
-> DB_NAME="egoweb" 
-> DB_USER="egowebuser" 
-> DB_USER_PASSWORD="egowebpass" 
-> echo "db_name is $DB_NAME" 
-> echo "db_user is $DB_USER" 
-> echo "db_user_password is $DB_USER_PASSWORD" 
-> source <ssinclude StackScriptID="1"> 
-> system_update 
-> postfix_install_loopback_only 
-> mysql_install "$DB_PASSWORD" && mysql_tune 40 
-> mysql_create_database "$DB_PASSWORD" "$DB_NAME" 
-> mysql_create_user "$DB_PASSWORD" "$DB_USER" "$DB_USER_PASSWORD" 
-> mysql_grant_user "$DB_PASSWORD" "$DB_USER" "$DB_NAME" 
-> php_install_with_apache && php_tune 
-> apache_install && apache_tune 40 
-> goodstuff 
-> a2enmod rewrite 
-> sudo apt-get install -y php5-mcrypt 
-> sudo php5enmod mcrypt 
-> sudo apt-get install -y git 
-> echo 'CLONING EGOWEB FROM GIT' 
-> git clone https://github.com/qualintitative/egoweb 
-> echo 'REMOVING DEFAULT WEB FILES' 
-> sudo rm -rf /var/www/* 
-> echo 'ADDING EGOWEB FILES TO WEB DIRECTORY' 
-> sudo cp -r egoweb/app/. /var/www/html/ 
-> echo 'SETTING UP TABLES IN MYSQL FOR EGOWEB - USE SQL FILE AS SOURCE' 
-> echo "SOURCE /egoweb/sql/egoweb_db.sql" | mysql egoweb -u root -p$DB_PASSWORD 
-> ELINENOF=$(grep -n '/var/www/' /etc/apache2/apache2.conf |cut -f1 -d:) 
-> echo "lineno is $ELINENOF" 
-> <nowiki>ELINENO=$(($ELINENOF + 2))</nowiki> 
-> echo "lineno is $ELINENO" 
-> echo "$ELINENO s/None/All/" 
-> sed -i -e "$ELINENO s/None/All/" /etc/apache2/apache2.conf 
-> restartServices 
-> cd /var/www/html 
->./initialize.sh 
 ----- -----
  
Line 434: Line 940:
  
 If there are database changes, these will be migrated into the existing data base and EgoWeb 2.0 will be fully updated. If there are no changes that need to be migrated, running this will confirm that your system is up to date. If there are database changes, these will be migrated into the existing data base and EgoWeb 2.0 will be fully updated. If there are no changes that need to be migrated, running this will confirm that your system is up to date.
- 
 ----- -----
 ~~DISCUSSION~~ ~~DISCUSSION~~
  • install.1586044097.txt.gz
  • Last modified: 2020/04/04 17:48
  • by wikimain