Differences
This shows you the differences between two versions of the page.
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 wikimain | install [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 ' | When prompted whether or not to install, hit ' | ||
Line 247: | Line 247: | ||
> ~/ | > ~/ | ||
+ | |||
+ | ----- | ||
+ | |||
+ | ====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:// | ||
+ | |||
+ | **2) Make a backup of your database. | ||
+ | |||
+ | **3) Make a copy of protected/ | ||
+ | |||
+ | Updating process: | ||
+ | |||
+ | **1) Download the latest version from the new_framework branch of the EgoWeb github located [[https:// | ||
+ | |||
+ | |||
+ | |||
+ | **2) On linux, run the command "rsync -avz app/ / | ||
+ | |||
+ | **3) Run the script ./ | ||
+ | |||
+ | **4) Update config files** | ||
+ | |||
+ | In main.php.backup, | ||
+ | |||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ) | ||
+ | |||
+ | Open the new main.php and look for the params section towards the end of the file. replace | ||
+ | |||
+ | ' | ||
+ | ' | ||
+ | // this is used in contact page | ||
+ | ' | ||
+ | // The max login attempt before showing captcha | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | // Enabling audio upload may make your server less secure | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ], | ||
+ | |||
+ | on some servers this might be ' | ||
+ | |||
+ | 2. Update the database username and password. | ||
+ | |||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | //' | ||
+ | ' | ||
+ | ' | ||
+ | ), | ||
+ | |||
+ | use the values above to replace the username and password values tin the " | ||
+ | |||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ], | ||
+ | |||
+ | On some servers use the default password egowebuser and egowebpass. | ||
+ | |||
+ | **5) Create new user accounts** | ||
+ | |||
+ | Passwords are encrypted differently in EgoWeb 2.0.10. | ||
+ | 1. Use the new password reset feature. | ||
+ | 2. Delete all the users in the user table in the database. | ||
+ | |||
+ | ===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. | ||
+ | |||
+ | After logging in, type these following commands: | ||
+ | |||
+ | > cd egoweb | ||
+ | > git pull | ||
+ | > rsync -avz app/ / | ||
+ | |||
+ | 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/ | ||
+ | |||
+ | 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:// | + | The script below is available in the [[http:// |
+ | |||
+ | Here are some notes provided by a project coordinator who set up an EgoWeb VM in 3/ | ||
+ | |||
+ | 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:// | ||
+ | 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 / | ||
+ | |||
+ | # <UDF name=" | ||
+ | |||
+ | DB_NAME=" | ||
+ | DB_USER=" | ||
+ | DB_USER_PASSWORD=" | ||
+ | |||
+ | echo " | ||
+ | echo " | ||
+ | echo " | ||
+ | echo " | ||
+ | |||
+ | ############################################## | ||
+ | # 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:: | ||
+ | } | ||
+ | |||
+ | 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 / | ||
+ | aptitude -y install dnsutils > /dev/null | ||
+ | fi | ||
+ | echo $(host $1 | awk '/ | ||
+ | } | ||
+ | |||
+ | 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=" | ||
+ | if [ ! -n " | ||
+ | echo " | ||
+ | return 1; | ||
+ | fi | ||
+ | echo " | ||
+ | hostname -F / | ||
+ | } | ||
+ | |||
+ | function system_add_host_entry() { | ||
+ | # $1 - The IP address to set a hosts entry for | ||
+ | # $2 - The FQDN to set to the IP | ||
+ | IPADDR=" | ||
+ | FQDN=" | ||
+ | if [ -z " | ||
+ | echo "IP address and/or FQDN Undefined" | ||
+ | return 1; | ||
+ | fi | ||
+ | echo $IPADDR $FQDN >> / | ||
+ | } | ||
+ | |||
+ | ########################################################### | ||
+ | # 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=" | ||
+ | USERPASS=" | ||
+ | if [ ! -n " | ||
+ | echo "No new username and/or password entered" | ||
+ | return 1; | ||
+ | fi | ||
+ | |||
+ | aptitude -y install sudo | ||
+ | adduser $USERNAME --disabled-password --gecos "" | ||
+ | echo " | ||
+ | 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=" | ||
+ | USERPUBKEY=" | ||
+ | if [ ! -n " | ||
+ | echo "Must provide a username and the location of a pubkey" | ||
+ | return 1; | ||
+ | fi | ||
+ | if [ " | ||
+ | mkdir / | ||
+ | echo " | ||
+ | return 1; | ||
+ | fi | ||
+ | mkdir -p / | ||
+ | echo " | ||
+ | chown -R " | ||
+ | } | ||
+ | |||
+ | function ssh_disable_root() { | ||
+ | # Disables root SSH access. | ||
+ | sed -i ' | ||
+ | touch / | ||
+ | } | ||
+ | |||
+ | ########################################################### | ||
+ | # Postfix | ||
+ | ########################################################### | ||
+ | |||
+ | function postfix_install_loopback_only() { | ||
+ | # Installs postfix and configure to listen only on the local interface. Also | ||
+ | # allows for local mail delivery | ||
+ | echo " | ||
+ | echo " | ||
+ | echo " | ||
+ | aptitude -y install postfix | ||
+ | / | ||
+ | #/ | ||
+ | touch / | ||
+ | } | ||
+ | |||
+ | ########################################################### | ||
+ | # 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 ' | ||
+ | if ! grep -q NameVirtualHost / | ||
+ | echo ' | ||
+ | cat / | ||
+ | mv -f / | ||
+ | fi | ||
+ | } | ||
+ | |||
+ | function apache_tune() { | ||
+ | # Tunes Apache' | ||
+ | # $1 - the percent of system memory to allocate towards Apache | ||
+ | if [ ! -n " | ||
+ | then PERCENT=40 | ||
+ | else PERCENT=" | ||
+ | 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 / | ||
+ | MAXCLIENTS=$((MEM*PERCENT/ | ||
+ | MAXCLIENTS=${MAXCLIENTS/ | ||
+ | sed -i -e " | ||
+ | touch / | ||
+ | } | ||
+ | |||
+ | function apache_virtualhost() { | ||
+ | # Configures a VirtualHost | ||
+ | # $1 - required - the hostname of the virtualhost to create | ||
+ | if [ ! -n " | ||
+ | echo " | ||
+ | return 1; | ||
+ | fi | ||
+ | |||
+ | if [ -e "/ | ||
+ | echo / | ||
+ | return; | ||
+ | fi | ||
+ | mkdir -p / | ||
+ | echo "< | ||
+ | echo " | ||
+ | echo " | ||
+ | echo " | ||
+ | echo " | ||
+ | echo "</ | ||
+ | a2ensite $1 | ||
+ | touch / | ||
+ | } | ||
+ | |||
+ | 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 " | ||
+ | echo " | ||
+ | return 1; | ||
+ | fi | ||
+ | if [ -e / | ||
+ | then echo $(awk '/ | ||
+ | fi | ||
+ | } | ||
+ | |||
+ | ########################################################### | ||
+ | # mysql-server | ||
+ | ########################################################### | ||
+ | |||
+ | function mysql_install() { | ||
+ | # $1 - the mysql root password | ||
+ | echo "mysql root pass is $1" | ||
+ | if [ ! -n " | ||
+ | echo " | ||
+ | return 1; | ||
+ | fi | ||
+ | echo " | ||
+ | echo " | ||
+ | apt-get -y install mysql-server mysql-client | ||
+ | echo " | ||
+ | sleep 5 | ||
+ | } | ||
+ | |||
+ | function mysql_tune() { | ||
+ | # Tunes MySQL' | ||
+ | # $1 - the percent of system memory to allocate towards MySQL | ||
+ | if [ ! -n " | ||
+ | then PERCENT=40 | ||
+ | else PERCENT=" | ||
+ | fi | ||
+ | sed -i -e ' | ||
+ | MEM=$(awk '/ | ||
+ | MYMEM=$((MEM*PERCENT/ | ||
+ | MYMEMCHUNKS=$((MYMEM/ | ||
+ | # 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[@]}; | ||
+ | sed -i -e "/ | ||
+ | done | ||
+ | for i in ${!OPTLIST[*]}; | ||
+ | val=$(echo | awk " | ||
+ | if [ $val -lt 4 ] | ||
+ | then val=4 | ||
+ | fi | ||
+ | config=" | ||
+ | done | ||
+ | sed -i -e " | ||
+ | touch / | ||
+ | } | ||
+ | |||
+ | function mysql_create_database() { | ||
+ | # $1 - the mysql root password | ||
+ | # $2 - the db name to create | ||
+ | if [ ! -n " | ||
+ | echo " | ||
+ | return 1; | ||
+ | fi | ||
+ | if [ ! -n " | ||
+ | echo " | ||
+ | return 1; | ||
+ | fi | ||
+ | echo " | ||
+ | } | ||
+ | |||
+ | function mysql_create_user() { | ||
+ | # $1 - the mysql root password | ||
+ | # $2 - the user to create | ||
+ | # $3 - their password | ||
+ | if [ ! -n " | ||
+ | echo " | ||
+ | return 1; | ||
+ | fi | ||
+ | |||
+ | if [ ! -n " | ||
+ | echo " | ||
+ | return 1; | ||
+ | fi | ||
+ | if [ ! -n " | ||
+ | echo " | ||
+ | return 1; | ||
+ | fi | ||
+ | echo " | ||
+ | } | ||
+ | |||
+ | function mysql_grant_user() { | ||
+ | # $1 - the mysql root password | ||
+ | # $2 - the user to bestow privileges | ||
+ | # $3 - the database | ||
+ | if [ ! -n " | ||
+ | echo " | ||
+ | return 1; | ||
+ | fi | ||
+ | |||
+ | if [ ! -n " | ||
+ | echo " | ||
+ | return 1; | ||
+ | fi | ||
+ | |||
+ | if [ ! -n " | ||
+ | echo " | ||
+ | return 1; | ||
+ | fi | ||
+ | echo "GRANT ALL PRIVILEGES ON $3.* TO ' | ||
+ | echo "FLUSH PRIVILEGES;" | ||
+ | } | ||
+ | |||
+ | ########################################################### | ||
+ | # PHP functions | ||
+ | ########################################################### | ||
+ | |||
+ | function php_install_with_apache() { | ||
+ | aptitude -y install php php-mysql libapache2-mod-php | ||
+ | touch / | ||
+ | } | ||
+ | |||
+ | function php_tune() { | ||
+ | # Tunes PHP to utilize up to 32M per process | ||
+ | iniloc=$(php --ini | grep Loaded | cut -d" " -f12) | ||
+ | # echo " | ||
+ | sed -i' | ||
+ | touch / | ||
+ | } | ||
+ | |||
+ | function php_fixtimeout() { | ||
+ | iniloc=$(php --ini | grep Loaded | cut -d" " -f12) | ||
+ | echo " | ||
+ | sed -i ' | ||
+ | sed -i ' | ||
+ | sed -i ' | ||
+ | sed -i ' | ||
+ | sed -i ' | ||
+ | sed -i ' | ||
+ | |||
+ | touch / | ||
+ | } | ||
+ | |||
+ | function php_fixtimeouta() { | ||
+ | iniloc=$(sudo find /etc/ -name php.ini | grep ' | ||
+ | echo " | ||
+ | sed -i ' | ||
+ | sed -i ' | ||
+ | sed -i ' | ||
+ | sed -i ' | ||
+ | sed -i ' | ||
+ | sed -i ' | ||
+ | |||
+ | touch / | ||
+ | |||
+ | } | ||
+ | |||
+ | ########################################################### | ||
+ | # Other niceties! | ||
+ | ########################################################### | ||
+ | |||
+ | function goodstuff() { | ||
+ | # Installs the REAL vim, wget, less, and enables color root prompt and the " | ||
+ | aptitude -y install wget vim less | ||
+ | sed -i -e ' | ||
+ | sed -i -e " | ||
+ | } | ||
+ | |||
+ | ########################################################### | ||
+ | # utility functions | ||
+ | ########################################################### | ||
+ | |||
+ | function restartServices() { | ||
+ | # restarts services that have a file in / | ||
+ | for service in $(ls / | ||
+ | / | ||
+ | rm -f / | ||
+ | done | ||
+ | } | ||
+ | |||
+ | function randomString { | ||
+ | if [ ! -n " | ||
+ | then LEN=20 | ||
+ | else LEN=" | ||
+ | fi | ||
+ | echo $(</ | ||
+ | } | ||
+ | |||
+ | export DEBIAN_FRONTEND=noninteractive | ||
+ | echo " | ||
+ | sudo apt-get update | ||
+ | sudo apt-get -y install aptitude | ||
+ | |||
+ | echo " | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | echo " | ||
+ | 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 | ||
+ | | ||
+ | | ||
+ | php_tune | ||
+ | php_fixtimeout | ||
+ | php_fixtimeouta | ||
+ | |||
+ | restartServices | ||
+ | |||
+ | a2enmod rewrite | ||
+ | |||
+ | sudo apt-get install -y git | ||
+ | echo ' | ||
+ | git clone https:// | ||
+ | echo ' | ||
+ | sudo rm -rf / | ||
+ | echo ' | ||
+ | sudo cp -r egoweb/ | ||
+ | echo ' | ||
+ | # echo " | ||
+ | mysql egoweb -u root -p$DB_PASSWORD < / | ||
+ | ELINENOF=$(grep -n '/ | ||
+ | ELINENO=$(($ELINENOF + 2)) | ||
+ | echo " | ||
+ | sed -i -e " | ||
+ | |||
+ | restartServices | ||
+ | |||
+ | cd / | ||
+ | |||
+ | ./ | ||
- | > #!/bin/bash | ||
- | > set -e | ||
- | > # <UDF name=" | ||
- | > DB_NAME=" | ||
- | > DB_USER=" | ||
- | > DB_USER_PASSWORD=" | ||
- | > echo " | ||
- | > echo " | ||
- | > echo " | ||
- | > source < | ||
- | > system_update | ||
- | > postfix_install_loopback_only | ||
- | > mysql_install " | ||
- | > mysql_create_database " | ||
- | > mysql_create_user " | ||
- | > mysql_grant_user " | ||
- | > 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 ' | ||
- | > git clone https:// | ||
- | > echo ' | ||
- | > sudo rm -rf /var/www/* | ||
- | > echo ' | ||
- | > sudo cp -r egoweb/ | ||
- | > echo ' | ||
- | > echo " | ||
- | > ELINENOF=$(grep -n '/ | ||
- | > echo " | ||
- | > < | ||
- | > echo " | ||
- | > echo " | ||
- | > sed -i -e " | ||
- | > restartServices | ||
- | > cd / | ||
- | > | ||
----- | ----- | ||
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~~ |