Ubuntu 管理心得

搜尋此網誌

2022年2月12日 星期六

Install LAMP server

 cf: https://upcloud.com/community/tutorials/installing-lamp-stack-ubuntu/

 

  1. sudo apt update
  2. sudo apt install apache 
  3. sudo systemctl status apache2
  4. sudo apt install php7.4 php7.4-mysql php-common php7.4-cli php7.4-json php7.4-common php7.4-opcache libapache2-mod-php7.4
  5. sudo systemctl restart apache2
  6. sudo apt install mariadb-server mariadb-client
  7. sudo systemctl status mariadb
  8. sudo mysql_secure_installation
    As you have no root password set for MariaDB you should simply press Enter when prompted, pressing Y on the next question to then set a root password (keep this safe and secure!) With that set, you can press Enter for the remaining questions as the defaults for each of these will help to secure your new installation.
  9. mysql_secure_installation

    https://mariadb.com/kb/en/mysql_secure_installation/
  10. Run mysql_secure_installation
  11. cf: https://kpchiaoo.blogspot.com/search?q=mysql
    If can't access mysql as mysql user root from normal user account but can access mysql without mysql root password from ubuntu root accout, then follow the lines below (the parentheses are comments):
    cf: https://askubuntu.com/questions/766334/cant-login-as-mysql-user-root-from-normal-user-account-in-ubuntu-16-04/801950
        (1). su - (get into ubuntu root account)
        (2). mysql -u root (get into mysql, should be no need password)
        (3). select User,host,plugin from mysql.user;
        (4). update mysql.user set plugin = 'mysql_native_password' where User='root';
        (5). select User,host,plugin from mysql.user; (plugin column should be changed)
        (6). SET PASSWORD FOR 'root'@'localhost' = PASSWORD('new password');
    or for mysql 8.0 in ubuntu 20.04
    ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'newpassord' 
        (7). flush privileges;
  12. sudo a2enmod userdir
  13. sudo a2enmod rewrite
  14. sudo vim php7.4.conf Commnent out the following lines:
    #<IfModule mod_userdir.c>
    #    <Directory /home/*/public_html>
    #        php_admin_flag engine Off
    #    </Directory>
    #</IfModule>
     
  15. sudo apt install phpmyadmin
  16. cf: https://stackoverflow.com/questions/42490647/phpmyadmin-installation-error-1045-acces-denied-using-password-no
    $ mysql -u root -p
    mysql> create database phpmyadmin;
    mysql> create user 'phpmyadmin'@'localhost' identified by 'some_passwd';

    mysql> grant all privileges on phpmyadmin.* to 'phpmyadmin'@'localhost'
  17. cd  /usr/share/phpmyadmin/sql
    $ mysql -u phpmyadmin -p phpmyadmin < create_tables.sql
  18. Edit /etc/php/7.4/apache2/php.ini
    post_max_size = 200M
    upload_max_filesize = 200M
  19. Edit /etc/apache2/apache2.conf, add the lines:
    <Directory /home/chiao/public_html/drupal9/web>
    Options FollowSymLinks
    AllowOverride AuthConfig FileInfo Indexes Limit Options=All,MultiViews
    </Directory>
  20. sudo systemctl restart apache2

 

沒有留言:

張貼留言

網誌存檔