AWSUbuntu: Difference between revisions

From Wiki RB4
 
(43 intermediate revisions by the same user not shown)
Line 1: Line 1:
==Data==
* public DNS: ec2-34-217-148-49.us-west-2.compute.amazonaws.com
* IP: 34.217.148.49
* Key Pair is the public and the private key. Key Pair Name: aws-ubuntu-magento2-test1
** public key on server is in <code>~/.ssh/authorized_keys</code>
** PEM and PPK files are located at <code>C:\Uwes\owncloud\documents\WendWeb\Magento2\</code>
===obsolete===
* public DNS: <s>ec2-34-220-188-76.us-west-2.compute.amazonaws.com</s>
* IP: <s>34.220.188.76</s>
==Operation==
===Manage Disc Space===
Get overview by
[[LinuxCommands#df|df command]]
and find the biggest files
sudo find / -type f -size +10M -exec ls -lh {} \; // files > 10MB
and delete unused packages
sudo apt autoremove
==[[Magento|Magento]]==
==[[Magento|Magento]]==
* installation according to [https://www.youtube.com/watch?v=aJDSigVa7To here] and update for PHP 7.2 according to [http://haraldwingerter.de/?p=882 here]
* new installation according to [https://devdocs.magento.com/guides/v2.3/install-gde/prereq/zip_install.html here] (upgrade [[#PHP|PHP]] to 7.2 before)
** mysql user=root pwd=root
* create directory /var/www/html/m<VERSION_WO_DOTS>_<INSTATLLATION_NUMBER>/
mysql --user=root --password=root
* copy Magente-CE-N.N.N_sample_data-<DATE>.tar.gz to new directory
* http://34.220.188.76/magento2/
* <code>sudo chown -R www-data:www-data /var/www/html/<MAGENTO_DIR>/</code>
* http://34.220.188.76/magento2/admin
* <code>sudo -u www-data tar zxf <FILENAME></code>
* <code>sudo chmod -R 777 /var/www/html/<MAGENTO_DIR>/</code> 
* create DB <MAGENTO_DIR> manually by [http://34.217.148.49/phpxmyadmin/ phpmyadmin]
* in browser call http://34.217.148.49/<MAGENTO_DIR>/setup
* give full access e.g to SAMBA users
* give full access e.g to SAMBA users
  sudo chmod -R 777 /var/www/html/
* to execute magento commands use another user
  sudo -u www-data php magento <MAGENTO_CMD>


To avoid errors
===Restart Instance===
  sudo chmod -R 777 /var/www/html/magento2/
After a AWS instance is restarted after a stop it gets a new IP address. So do
* update links
* update config data in DB in table core_config_data and path = web/unsecure/base_url and web/secure/base_url
* clean cache by
  ubuntu@ip-172-31-29-54:/var/www/html/m230_1/bin$ sudo -u www-data php magento cache:clean


==MySQL==
==MySQL==
Line 29: Line 57:
  // test
  // test
  sudo mysql -u root -p
  sudo mysql -u root -p
==PHP==
* update from 7.0 to 7.2 according to [http://haraldwingerter.de/?p=882 here] and [https://www.liquidweb.com/kb/install-php-7-2-ubuntu-16-04/ here] (list of old libs in myphppackages.txt)
* remove 7.0 by
  sudo apt-get purge --auto-remove php7.0
* downgrade to PHP 7.1 according to [https://serverfault.com/questions/895746/switch-from-php-7-2-to-7-1-on-ubuntu-16-04-apache here] and correct Magento error according to  [https://stackoverflow.com/questions/14395239/class-domdocument-not-found here]
* after Magento setup error do:
sudo apt-get install php7.1-curl
sudo apt-get install php7.1-bcmath
sudo apt-get install php7.1-gd
sudo apt-get install php7.1-intl
sudo apt-get install php7.1-soap


==PHPMyAdmin==
==PHPMyAdmin==
Line 41: Line 81:
* restart apache
* restart apache
  sudo service apache2 restart
  sudo service apache2 restart
* correction of error in <code>/usr/share/phpmyadmin/libraries/sql.lib.php</code>


==Samba==
==Samba==
Line 50: Line 91:
  \etc\samba\smb.conf.sik
  \etc\samba\smb.conf.sik
* edit security group according to [https://github.com/GlanceIt/GlanceWebsite/wiki/Installing-Samba-on-EC2-instance here]
* edit security group according to [https://github.com/GlanceIt/GlanceWebsite/wiki/Installing-Samba-on-EC2-instance here]
==Known Problems==
* Diese Seite funktioniert nicht 34.217.148.49 kann diese Anfrage momentan nicht verarbeiten. HTTP ERROR 500 => see /var/log/apache2/error.log
** could be PHP version error

Latest revision as of 23:14, 24 January 2020

Data[edit]

  • public DNS: ec2-34-217-148-49.us-west-2.compute.amazonaws.com
  • IP: 34.217.148.49
  • Key Pair is the public and the private key. Key Pair Name: aws-ubuntu-magento2-test1
    • public key on server is in ~/.ssh/authorized_keys
    • PEM and PPK files are located at C:\Uwes\owncloud\documents\WendWeb\Magento2\

obsolete[edit]

  • public DNS: ec2-34-220-188-76.us-west-2.compute.amazonaws.com
  • IP: 34.220.188.76

Operation[edit]

Manage Disc Space[edit]

Get overview by

df command

and find the biggest files

sudo find / -type f -size +10M -exec ls -lh {} \; // files > 10MB

and delete unused packages

sudo apt autoremove

Magento[edit]

  • new installation according to here (upgrade PHP to 7.2 before)
  • create directory /var/www/html/m<VERSION_WO_DOTS>_<INSTATLLATION_NUMBER>/
  • copy Magente-CE-N.N.N_sample_data-<DATE>.tar.gz to new directory
  • sudo chown -R www-data:www-data /var/www/html/<MAGENTO_DIR>/
  • sudo -u www-data tar zxf <FILENAME>
  • sudo chmod -R 777 /var/www/html/<MAGENTO_DIR>/
  • create DB <MAGENTO_DIR> manually by phpmyadmin
  • in browser call http://34.217.148.49/<MAGENTO_DIR>/setup
  • give full access e.g to SAMBA users
  • to execute magento commands use another user
sudo -u www-data php magento <MAGENTO_CMD>

Restart Instance[edit]

After a AWS instance is restarted after a stop it gets a new IP address. So do

  • update links
  • update config data in DB in table core_config_data and path = web/unsecure/base_url and web/secure/base_url
  • clean cache by
ubuntu@ip-172-31-29-54:/var/www/html/m230_1/bin$ sudo -u www-data php magento cache:clean

MySQL[edit]

  • version
mysql -V // -> 5.7.25
sudo /etc/init.d/mysql stop
sudo mkdir /var/run/mysqld/
sudo chown mysql /var/run/mysqld/
sudo mysqld_safe --skip-grant-tables &
ENTER
sudo mysql -u root
use mysql;
update user set authentication_string=PASSWORD("pHalloo0@1p") where User='root';
flush privileges;
exit;
sudo /etc/init.d/mysql stop
sudo /etc/init.d/mysql start
// test
sudo mysql -u root -p

PHP[edit]

  • update from 7.0 to 7.2 according to here and here (list of old libs in myphppackages.txt)
  • remove 7.0 by
 sudo apt-get purge --auto-remove php7.0
  • downgrade to PHP 7.1 according to here and correct Magento error according to here
  • after Magento setup error do:
sudo apt-get install php7.1-curl
sudo apt-get install php7.1-bcmath
sudo apt-get install php7.1-gd
sudo apt-get install php7.1-intl
sudo apt-get install php7.1-soap

PHPMyAdmin[edit]

  • sudo apt-get install -y phpmyadmin
  • use MySQL root password
  • change PHPMyAdmin URL
cd /etc/apache2/conf-available/
alias phpmyadmin -> phpxmyadmin
  • ren /var/www/html/phpmyadmin
cd /var/www/html/
mv phpmyadmin phpxmyadmin
  • restart apache
sudo service apache2 restart
  • correction of error in /usr/share/phpmyadmin/libraries/sql.lib.php

Samba[edit]

  • installation according to here
    • user: ubuntu
    • password: Halloo0@1
    • share: HTML_SHARE
    • backup of configuration
\etc\samba\smb.conf.sik
  • edit security group according to here

Known Problems[edit]

  • Diese Seite funktioniert nicht 34.217.148.49 kann diese Anfrage momentan nicht verarbeiten. HTTP ERROR 500 => see /var/log/apache2/error.log
    • could be PHP version error