GCP 安裝 Ubuntu 18.04筆記

# 安裝mariadb 10.4
sudo apt-get install software-properties-common
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
sudo add-apt-repository 'deb [arch=amd64,arm64,ppc64el] http://mirror.jaleco.com/mariadb/repo/10.4/ubuntu bionic main'

sudo apt update
sudo apt install mariadb-server

# 加入php ppa
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update

# 加入nginx ppa
sudo add-apt-repository ppa:nginx/stable
sudo apt-get update

# 安裝程式
sudo apt install nginx php7.2-gd php7.2-xml php7.2-mbstring php7.2-fpm php7.2-mysql unzip php-pear

# mysql root角色密碼調整
sudo mysql -u root
DROP USER 'root'@'localhost';
CREATE USER 'root'@'localhost' IDENTIFIED BY '';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION;
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('yourpassword');
FLUSH PRIVILEGES;

# 安裝 composer
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer

# 安裝 drush8.2.3
composer global require drush/drush:8.2.3
( 應該會裝在這個目錄 /home/cloud/.config/composer )

alias drush='/usr/bin/php ~/.config/composer/vendor/drush/drush/drush.php'

drush init
( 執行完會裝drush的執行寫到bashrc )

其他

# mysql 不打密碼
.my.cnf
[client]
user=mysqluser
password=mysqlpass

# 目錄權限調整
sudo chown -R www-data:www-data /var/www/drupal

# 將使用者及www-data權限群組互加 ps.或許不用??
sudo adduser cloud www-data
sudo adduser www-data cloud

# 在目錄執行drush不會有權限問題可將此段加入basrhrc
alias drush='sudo -u www-data ~/.config/composer/vendor/drush/drush/drush.php'

cat ~/.bashrc 

# Path to Drush, added by 'drush init'.
export PATH="$PATH:$HOME/.config/composer/vendor/bin"


# Include Drush bash customizations.
if [ -f "/home/cloud/.drush/drush.bashrc" ] ; then
  source /home/cloud/.drush/drush.bashrc
fi


# Include Drush completion.

if [ -f "/home/cloud/.drush/drush.complete.sh" ] ; then
  source /home/cloud/.drush/drush.complete.sh
fi


# Include Drush prompt customizations.

if [ -f "/home/cloud/.drush/drush.prompt.sh" ] ; then
  source /home/cloud/.drush/drush.prompt.sh
fi

alias drush='sudo -u www-data ~/.config/composer/vendor/drush/drush/drush.php'

留言

熱門文章