Deploy Magento
Debian 12
In [ ]:
sudo apt install docker.io
In [ ]:
sudo usermod -aG docker saintway
In [ ]:
sudo service docker start
In [ ]:
sudo service docker status
In [ ]:
docker pull mysql
In [ ]:
docker run --name mobaichi -p 127.0.0.1:3306:3306 -e MYSQL_ROOT_PASSWORD=mobaichi -d mysql:8.0-debian
CREATE DATABASE mobaichi;
CREATE USER 'ekp'@'172.17.0.1' IDENTIFIED BY 'ekp';
GRANT ALL PRIVILEGES ON mobaichi.* TO 'ekp'@'172.17.0.1';
FLUSH PRIVILEGES;
EXIT;
Debian 11
In [ ]:
sudo apt install wget
In [ ]:
wget https://dev.mysql.com/get/mysql-apt-config_0.8.26-1_all.deb
In [ ]:
sudo apt install lsb-release
In [ ]:
sudo dpkg -i ~/mysql-apt-config_0.8.26-1_all.deb
In [ ]:
sudo apt update
In [ ]:
sudo apt install mysql-server
In [ ]:
import random
import string
''.join(
random.choices(string.ascii_letters + string.digits, k=8)
)
# MySQL
# KQaJ6rYR
CREATE DATABASE mobaichi;
CREATE USER 'ekp'@'localhost' IDENTIFIED BY 'ekp';
GRANT ALL PRIVILEGES ON mobaichi.* TO 'ekp'@'localhost';
FLUSH PRIVILEGES;
EXIT;
Ubuntu 22
In [ ]:
sudo apt install mysql-server
In [ ]:
mysql --version
In [ ]:
sudo netstat -tunpl | grep mysql
In [ ]:
sudo service mysql status
CREATE DATABASE mobaichi;
CREATE USER 'ekp'@'localhost' IDENTIFIED BY 'ekp';
GRANT ALL PRIVILEGES ON mobaichi.* TO 'ekp'@'localhost';
FLUSH PRIVILEGES;
EXIT;
Debian 11
In [ ]:
sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
sudo sh -c 'echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'
In [ ]:
sudo apt update
In [ ]:
sudo apt install php8.2
In [ ]:
php -v
In [ ]:
php --ini
In [ ]:
php -m
In [ ]:
sudo apt install php8.2-bcmath
sudo apt install php8.2-curl
sudo apt install php8.2-dom
sudo apt install php8.2-gd
sudo apt install php8.2-intl
sudo apt install php8.2-mysql
sudo apt install php8.2-simplexml
sudo apt install php8.2-soap
sudo apt install php8.2-xsl
sudo apt install php8.2-zip
In [ ]:
sudo apt install php-mbstring
In [ ]:
composer global require psy/psysh
In [ ]:
~/.config/composer/vendor/bin/psysh
zmq
In [ ]:
git clone https://github.com/zeromq/php-zmq.git
In [ ]:
cd ~/php-zmq && phpize && ./configure
cd ~/php-zmq && make
cd ~/php-zmq && sudo make install
jupyter-php-kernel
In [ ]:
git clone https://github.com/amemoba/jupyter-php-kernel.git ~/jupyter-php-kernel
In [ ]:
cd ~/jupyter-php-kernel && composer install
In [ ]:
git clone https://github.com/amemoba/jupyter-php-install.git ~/jupyter-php-install
In [ ]:
cd ~/jupyter-php-install && composer install
In [ ]:
cd ~/jupyter-php-install && php src/EntryPoint/main.php -v install
In [ ]:
sudo apt install docker.io
In [ ]:
sudo usermod -aG docker saintway
In [ ]:
docker network create elastic
In [ ]:
docker pull docker.elastic.co/elasticsearch/elasticsearch:8.10.2
In [ ]:
docker run --name elasticsearch --net elastic -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" -t docker.elastic.co/elasticsearch/elasticsearch:8.10.2
In [ ]:
docker pull docker.elastic.co/elasticsearch/elasticsearch:7.17.13
In [ ]:
docker run --name elasticsearch --net elastic -p 127.0.0.1:9200:9200 -p 127.0.0.1:9300:9300 -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:7.17.13
In [ ]:
curl -X GET http://localhost:9200/
In [ ]:
docker start elasticsearch
docker logs elasticsearch
In [ ]:
sudo apt install apache2
In [ ]:
sudo apt install composer
In [ ]:
composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition ~/magento2
In [ ]:
git clone https://github.com/magento/magento2 ~/magento2
In [ ]:
cd ~/magento2 && git branch
In [ ]:
cd ~/magento2 && git fetch --tags
In [ ]:
cd ~/magento2 && git checkout 2.4.6-p3
In [ ]:
cd ~/magento2 && composer install
In [ ]:
import random
import string
''.join(
random.choices(string.ascii_lowercase + string.digits, k=7)
)
# --admin-firstname=i \
# --admin-lastname=sei \
# --admin-email=sei@ekp.co.jp \
# --admin-user=ekp \
# --admin-password=5b0gs9x \
In [ ]:
cd ~/magento2/ && yes | bin/magento setup:uninstall
In [ ]:
cd ~/magento2/ && bin/magento setup:install \
--base-url=http://jhub.name:8890 \
--db-host=127.0.0.1 \
--db-name=mobaichi \
--db-user=ekp \
--db-password=ekp \
--admin-firstname=i \
--admin-lastname=sei \
--admin-email=sei@ekp.co.jp \
--admin-user=ekp \
--admin-password=5b0gs9x \
--language=ja_JP \
--currency=JPY \
--timezone=Asia/Tokyo \
--use-rewrites=1 \
--search-engine=elasticsearch7 \
--elasticsearch-host=localhost \
--elasticsearch-port=9200 \
--elasticsearch-index-prefix=mobaichi \
--elasticsearch-timeout=15
In [ ]:
php -S localhost:8890 -t ~/magento2/pub/ ~/magento2/phpserver/router.php
In [ ]:
php -S 127.0.0.1:8890 -t ~/magento2/pub/ ~/magento2/phpserver/router.php
In [ ]:
cd ~/magento2/ && bin/magento cron:install --force
In [ ]:
crontab -l
In [ ]:
cd ~/magento2/ && bin/magento cron:run --group index
In [ ]:
cd ~/magento2/ && bin/magento cron:run --group default
In [ ]:
cd ~/magento2/ && bin/magento cron:remove
In [ ]:
cd ~/magento2/ && bin/magento help setup:config:set
In [ ]:
cd ~/magento2/ && bin/magento help setup:store-config:set
In [ ]:
cd ~/magento2/ && bin/magento help config:set
In [ ]:
cd ~/magento2/ && bin/magento list
In [ ]:
cd ~/magento2/ && bin/magento app:config:status
In [ ]:
cd ~/magento2/ && bin/magento cache:clean
In [ ]:
cd ~/magento2/ && bin/magento cache:status
In [ ]:
cd ~/magento2/ && bin/magento deploy:mode:set developer
In [ ]:
cd ~/magento2/ && bin/magento deploy:mode:show
In [ ]:
cd ~/magento2/ && bin/magento config:set web/url/redirect_to_base 0
In [ ]:
cd ~/magento2/ && bin/magento config:set web/seo/use_rewrites 0
In [ ]:
cd ~/magento2/ && bin/magento config:set web/unsecure/base_url http://jhub.name:8890/
In [ ]:
cd ~/magento2/ && bin/magento config:set web/secure/base_url http://jhub.name:8890/
In [ ]:
cd ~/magento2/ && bin/magento config:set web/unsecure/base_url https://jhub.name/magento/
In [ ]:
cd ~/magento2/ && bin/magento config:set web/secure/base_url https://jhub.name/magento/
In [ ]:
cd ~/magento2/ && bin/magento config:show
In [ ]:
git clone https://github.com/amemoba/magento-i18n ~/amemoba-kobe/app/i18n/Magento
In [ ]:
cd ~/amemoba-kobe && bin/magento cache:clean
In [ ]:
rm ~/amemoba-kobe/pub/static/adminhtml/Magento/backend/zh_Hans_CN/js-translation.json
rm ~/amemoba-kobe/pub/static/frontend/Magento/luma/zh_Hans_CN/js-translation.json
In [ ]:
cd ~/amemoba-kobe && bin/magento setup:static-content:deploy -f zh_Hans_CN
cd ~/amemoba-kobe && bin/magento cache:flush
In [ ]:
cd /mnt/d && git clone https://github.com/magentoj/language-ja_JP magento-ja
In [ ]:
mkdir -p ~/amemoba-kobe/app/i18n/Magento/ja_JP/
cp /mnt/d/magento-ja/composer.json ~/amemoba-kobe/app/i18n/Magento/ja_JP/
cp /mnt/d/magento-ja/language.xml ~/amemoba-kobe/app/i18n/Magento/ja_JP/
cp /mnt/d/magento-ja/LICENSE.txt ~/amemoba-kobe/app/i18n/Magento/ja_JP/
cp /mnt/d/magento-ja/LICENSE_AFL.txt ~/amemoba-kobe/app/i18n/Magento/ja_JP/
cp /mnt/d/magento-ja/registration.php ~/amemoba-kobe/app/i18n/Magento/ja_JP/
In [ ]:
cp /mnt/d/magento-ja/ja_JP.csv ~/amemoba-kobe/app/i18n/Magento/ja_JP/
In [ ]:
cd ~/amemoba-kobe && bin/magento cache:clean
In [ ]:
rm ~/amemoba-kobe/pub/static/adminhtml/Magento/backend/ja_JP/js-translation.json
rm ~/amemoba-kobe/pub/static/frontend/Magento/luma/ja_JP/js-translation.json
In [ ]:
cd ~/amemoba-kobe && bin/magento setup:static-content:deploy -f ja_JP
cd ~/amemoba-kobe && bin/magento cache:flush
In [ ]:
git clone https://github.com/degica/komoju-magento.git ~/komoju
In [ ]:
cp -r ~/komoju/src/app/code/Komoju ~/magento2/app/code
In [ ]:
cd ~/magento2 && bin/magento setup:upgrade
cd ~/magento2 && bin/magento setup:di:compile
cd ~/magento2 && bin/magento cache:flush
In [ ]:
cd ~/magento2 && bin/magento -f setup:static-content:deploy
In [ ]:
sudo apt update
sudo apt install nodejs
sudo apt install npm
In [ ]:
npm -v
In [ ]:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash
In [ ]:
nvm install 14
In [ ]:
node -v
In [ ]:
npm install hexo-cli -g
In [ ]:
hexo init ~/amemoba-kansai
In [ ]:
cd ~/amemoba-kansai && npm install
In [ ]:
git clone https://github.com/EvanNotFound/hexo-theme-redefine.git ~/amemoba-kansai/themes/redefine
In [ ]:
wget https://amemoba.com/wpn/wp-content/themes/amemoba/images/favicon.ico -O ~/amemoba-kansai/themes/redefine/source/images/amemoba-favicon.ico
In [ ]:
wget https://amemoba.com/wpn/wp-content/themes/amemoba/images/common/header-logo.png -O ~/amemoba-kansai/themes/redefine/source/images/amemoba-avatar.png
In [ ]:
cd ~/amemoba-kansai && hexo server
In [ ]:
cd ~/amemoba-kansai && npm install hexo-deployer-git --save
Bash
In [ ]:
wget https://amemoba.com/wpn/wp-content/themes/amemoba/images/favicon.ico -O ~/amemoba-kansai/themes/keep/source/images/amemoba-favicon.ico
In [ ]:
pip install pillow
Python
In [ ]:
from PIL import Image
# 打开图片
image = Image.open('/home/saintway/amemoba-kansai/themes/keep/source/images/amemoba-favicon.png')
# 将图像转换为 RGBA 模式(如果尚未为 RGBA)
image = image.convert('RGBA')
# 获取图片的尺寸
width, height = image.size
# 处理每个像素
for x in range(width):
for y in range(height):
r, g, b, a = image.getpixel((x, y))
# 判断像素是否为红色(根据具体情况来判断颜色)
if r > 150 and g < 100 and b < 100:
# 将红色部分替换为蓝色
image.putpixel((x, y), (b, g, r, a)) # 设置像素为蓝色并保持原透明度
else:
# 在新图像上复制原图的非红色部分
image.putpixel((x, y), (r, g, b, a))
# 保存修改后的图片
image.save('/home/saintway/amemoba-kansai/themes/keep/source/images/amemoba-favicon.png')
Bash
In [ ]:
wget https://amemoba.com/wpn/wp-content/themes/amemoba/images/common/header-logo.png -O ~/amemoba-kansai/themes/keep/source/images/amemoba-avatar.png
Python
In [ ]:
from PIL import Image
# 打开图片
image = Image.open('/home/saintway/amemoba-kansai/themes/keep/source/images/amemoba-avatar.png')
# 将图像转换为 RGBA 模式(如果尚未为 RGBA)
image = image.convert('RGBA')
# 获取图片的尺寸
width, height = image.size
# 处理每个像素
for x in range(width):
for y in range(height):
r, g, b, a = image.getpixel((x, y))
# 判断像素是否为红色(根据具体情况来判断颜色)
if r > 150 and g < 100 and b < 100:
# 将红色部分替换为蓝色
image.putpixel((x, y), (b, g, r, a)) # 设置像素为蓝色并保持原透明度
else:
# 在新图像上复制原图的非红色部分
image.putpixel((x, y), (r, g, b, a))
# 保存修改后的图片
image.save('/home/saintway/amemoba-kansai/themes/keep/source/images/amemoba-avatar.png')
In [ ]:
from PIL import Image
# 打开图片
image = Image.open('/home/saintway/amemoba-kansai/themes/keep/source/images/amemoba-avatar.png')
# 将图像转换为 RGBA 模式(如果尚未为 RGBA)
image = image.convert('RGBA')
# 获取图片的尺寸
width, height = image.size
# 处理每个像素
for x in range(width):
for y in range(height):
r, g, b, a = image.getpixel((x, y))
# 判断像素是否为蓝色(根据具体情况来判断颜色)
if r < 100 and g < 100 and b > 150:
# 将蓝色部分替换为红色
image.putpixel((x, y), (b, g, r, a)) # 设置像素为红色并保持原透明度
else:
# 在新图像上复制原图的非蓝色部分
image.putpixel((x, y), (r, g, b, a))
# 保存修改后的图片
image.save('/home/saintway/amemoba-kansai/themes/keep/source/images/amemoba-avatar.png')
In [ ]: