如何避免執行此指令 'sudo amazon-linux-extras install -y lamp-mariadb10.2-php7.2 php7.2'?
P粉938936304
P粉938936304 2023-12-13 19:01:43
0
1
437

我正在關注本教學:https://aws.amazon.com/getting-started/hands-on/deploy-wordpress-with-amazon-rds/?refid=dd707452-50b0-4e41-9f2b-d84c7ca273d4嘗試在AWS的ec2/rds上建立我自己的wordpress伺服器。

但是,我不想運行這條線

sudo amazon-linux-extras install -y lamp-mariadb10.2-php7.2 php7.2

因為wordpress不喜歡php7.2。這是我第二次通過,我發現的第一件事是我需要升級 php,一旦安裝,這似乎是不可能的。我也找不到任何方法來刪除安裝後的這個軟體包。但是,我找不到任何“更新”的方法來做到這一點。我最終不得不拋開一切並重新開始。

如果沒有這個,我該如何讓httpd運行wordpress?

編輯:顯示的軟體包在安裝後顯示它已達到支援生命週期。

P粉938936304
P粉938936304

全部回覆(1)
P粉662089521

在亞馬遜AWS ec2上啟動wordpress:

  1. 啟動實例(ubuntu),產生金鑰對
  2. 打開 ssh 終端機並執行以下命令
//just update and upgrade apt repositories
sudo apt update
sudo apt upgrade

//install apache2
sudo apt install apache2 -y
sudo systemctl start apache2

//install PHP
sudo apt-get install software-properties-common
sudo add-apt-repository -y ppa:ondrej/php
sudo apt-get update

sudo apt-get install php -y

//i suppose above it installed php8.1 
//so installing all other related tophp8.1

sudo apt-get install php8.1-cli php8.1-common

//actually these extensions were used for laravel,
//so not all might needed for WordPress but you can install all of these

sudo apt-get install apache2 php8.1 libapache2-mod-php8.1 php8.1-curl php-pear php8.1-gd php8.1-dev php8.1-zip php8.1-mbstring php8.1-mysql php8.1-xml curl -y
sudo apt install -y php8.1-bcmath  php8.1-ctype
sudo apt-get install zip unzip php8.1-zip

sudo systemctl restart apache2

//enter ipaddress on browser, it should show localhost, if installed successfully

//install MySQL
sudo apt install mysql-server
sudo mysql 

//inside mysql tab
==============
ALTER USER 'root'@'localhost' IDENTIFIED BY 'NewPassword';
create database database_name;
exit;
=================

//install Wordpress 
//go to default HTML directory

cd /var/www/html

//now push file to on this directory from git, if you have it on local
// or install a new from repo
// you can consider /var/www/ as your htdocs folder in xampp

//now need to set up your DNS
// for this you can view some tutorial on `route 53` DNS hosting, you have to  allocate elastic IP address, and map your domain to this IP
  1. 假設您的網域是 sarojsshrestha.com 接下來,您需要執行以下命令將網域對應到 /var/www/html
#
cd /etc/apache2/sites-available

//disable default conf
sudo a2dissite 000-default.conf 

//create new conf for your domain
sudo nano sarojshrestha.com.conf

//and paste this following:


    ServerName sarojshrestha.com
    ServerAlias www.sarojshrestha.com
    ServerAdmin admin@sarojshrestha.com

    DocumentRoot /var/www/html
    
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Require all granted
    

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined



//save and exit by ctrl+s and ctrl+x
  1. 接下來,啟用此功能。
sudo a2ensite sarojshrestha.com

現在,在瀏覽器上點擊 sarojshrestha.com,您應該會看到 Wordpress 設定視圖。將 sarojsrestha.com 替換為您的實際網域。

順便說一下,安裝時,您可能需要更改 /var/www/html 資料夾的權限。如果您發現任何問題,可以告訴我。

熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!