init
KUSANAGI initialization
Set or change the user passwords of Linux and databases in the KUSANAGI virtual machine.
Command Line
kusanagi init
Parameters
--tz TZ | Designate TZ as timezone.This string is case-insensitive。 Also, timezone will be define as “Asia/Tokyo” even the string is not incomplete such as “Toky”. Designate multi or numerous timezone will cause the error occurred. If didn’t designate Option--tz as timezone, select the timezone as interactive behavior. |
---|---|
--lang [en|ja] | Select your language. Designate en will defined as en_US.UTF-8. Further, designate ja will defined as ja_JP.UTF-8. |
--keyboard [en|ja] | Configure keyboard layout.Designate en or ja. Designate us keyboard with Option--keyboard en.Further, designate ja keyboard(jp106) with Option--lang ja. If didn’t designate Option--keyboard as keyboard, select the keyboard as interactive behavior. |
--passwd password | --kusanagi-pass password | Configure KUSANAGI user password. If didn’t designate --passwd either --kusanagi-pass as password, configure a password as interactive behavior. |
--phrase phrase | --kusanagi-phrase phrase | --nophrase|--no-phrase | If designate Option--phrase either--kusanagi-phrase, configure the phrase with kusanagi SSH user’s key phrase as interactive behavior. Configure the phrase at least more then 5 more letters. If didn’t designate Option--nophrase either--no-phrase,user kusanagi SSH user’s key phrase will configure as blank string. When designate this option (--phrase,--kusanagi-phrase, --nophrase,--no-phrase) in same time, even designate option afterward also would be effective. When didn’t designate this Option (--phrase,--kusanagi-phrase, --nophrase,--no-phrase), configure SSH user’s key phrase as interactive behavior. |
--dbrootpass password | Designate MySQL root’s password. This password should be designate by using 「A~Z,a~z,0~9,.,!,#,%,+,_,-」and at least more then 8 letters When didn’t designate this Option --dbrootpass ,configure MySQL root password as interactive behavior. |
--nginx | --httpd | Designate to active server.If designate to NGINX, enter --nginx to execute, enter --httpd to active Apache2 server. If designate Option --nginx,--httpd in the same time, the previous option only will be execute. If didn’t designate Option --nginx,--httpd, designate to active server as interactive behavior. |
--hhvm | --php8 | --php7 | --php5 | Designate to active the application server.Enter --hhvm to active HHVM, enter --php8 to active PHP8, , enter --php7 to active PHP7, enter --php5 to active PHP-FPM(PHP5). If designate Option --hhvm,--php8,--php7,--php5 in the same time, the previous option only will be execute. If didn’t designate Option --hhvm,--php8,--php7,--php5 ,designate to active application server as interactive behavior. |
Example
For more details, please refer to KUSANAGI Initialization
provision [profile]
WordPress Provision
A profile created by KUSANAGI for WordPress installation. Web server configuration , document root will provision in this profile.
Example
kusanagi provision [options] profile
Parameter
--WordPress|--wordpress | WordPress Provision Even didn’t enter the following options --concrete5,-c5,--drupal8,--drupal,--lamp,--LAMP ,will be automatic provisioning with WordPress. If designate the following Option --WordPress,--wordpress,--concrete5,-c5,--drupal8,--drupal,--lamp,--LAMP multiple times, the latest designated option only would be effective. |
---|---|
--concrete5|--c5 | Provision with Concrete5 |
--drupal8|--drupal | Provision with Drupal8 |
--lamp|--LAMP | Provision with LAMP(Linux+NGINX+MySQL+PHP) or LEMP(Linux+NGINX+MySQL+PHP). |
--wplang [en_US|ja] | Only effective while WordPress is provisioning. Designate to en_US will able to choose language while WordPress installing. Designate to ja will install WordPress Japanese version WordPress. If didn’t designate Option--wplang, will configure en_US either ja as interactive behavior. |
--WooCommerce|--woo | Only effective while WordPress is provisioning. Designate Option --WooCommerce or --woo will install WooCommerce in the same time while WordPress installing. While configuring --wplang ja ,or installing by Japanese language as interactive behavior. WooCommerce Japanese package, WooCommerce plugin for Japan, GMO permanent plugin will be installing in the same time. |
--fqdn hostname | Designate the hostname(FQDN) for profile.When Designate is specified, the host name is set in the web server configuration file and /etc/hosts file. If didn’t designate Option--fqdn, will configure the hostname as interactive behavior. |
--email Email address|--noemail|--no-email | Designate Option --email , using the designated email to issue Let’s Encrypt ssl certificate. If designate Option --noemail either --no-email, Let’s Encrypt SSL certificate won’t issue. Designated the following Options --email、--noemail、--no-email mulitiple times,the latest designated only will be effective. If didn’t designated Option --email、--noemail、--no-email, will configure the email address as interactive behavior. |
--dbname database name | Using designate database name create a new database. Configure database name by 「A~Z、a~z、0~9、.、_、-」and the letters should be between 3~64. If didn’t designate Options --dbname, will configure database name as interactive behavior. |
--dbuser DB username | Designate to database username to access to database which created previously. Configure the DB username by「A~Z、a~z、0~9、.、_、-」and should be between 3~16 letters. If didn’t designate Option--dbuser, configure DB username as interactive behavior. |
--dbpass DB password | Configure the DB password as DB user. Configure the DB password 「A~Z、a~z、0~9、.、!、#、%、+、_、-」and at least more than 8 letters. If didn’t designate Option --dbpass, configure DB password as interactive password. |
profile | Random to designate profile. プロファイルは、「A~Z、a~z、0~9、.、_、-」の組み合わせからなる3~24文字の文字列である必要があります。 |
Example
Please refer to 『WordPress Provision』
status
Show the current status of KUSANAGI.
Command Line
kusanagi status
Parameters
None
Example
# kusanagi status Profile: [プロファイル] Type: WordPress KUSANAGI Version 8.0.0 [VMイメージ名] *** nginx *** ● nginx.service - The NGINX HTTP and reverse proxy server Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled) Active: active (running) since Wed 2016-09-07 11:51:22 JST; 6h ago *** Apache2 *** ● httpd.service - The Apache HTTP Server Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled) Active: inactive (dead) *** HHVM *** ● hhvm.service - HHVM virtual machine, runtime, and JIT for the PHP language Loaded: loaded (/etc/systemd/system/hhvm.service; enabled; vendor preset: disabled) Active: active (running) since Wed 2016-09-07 11:51:22 JST; 6h ago *** php-fpm *** ● php-fpm.service - The PHP FastCGI Process Manager Loaded: loaded (/usr/lib/systemd/system/php-fpm.service; disabled; vendor preset: disabled) Active: inactive (dead) *** php7-fpm *** ● php7-fpm.service - The PHP FastCGI Process Manager Loaded: loaded (/usr/lib/systemd/system/php7-fpm.service; disabled; vendor preset: disabled) Active: inactive (dead) *** Cache Status *** fcache off bcache off Done
The contents should be like the following.
- Profile
Current Profile - Type
カレントプロファイルのプロファイルタイプ(WordPress, concrete5, drupal8, lampのいずれかが入る)。 - KUSANGI Version
Current version of KUSANAGI. - VMイメージ名
使用するクラウドプロバイダ固有の文字列。 - *** nginx ***
NGINXのステータス。起動しているときは、Active行にrunning が表示される。 - *** Apache2 ***
Apache2(httpd)のステータス。起動しているときは、Active行にrunning が表示される。 - *** HHVM ***
HHVMのステータス。起動しているときは、Active行にrunning が表示される。 - *** PHP-FPM ***
PHP-FPM(PHP5)のステータス。起動しているときは、Active行にrunning が表示される。 - *** PHP7 ***
PHP7のステータス。起動しているときは、Active行にrunning が表示される。 - fcache
fcache がon か off かを表示する。 - bcache
bcache がon か off かを表示する。プロビジョンタイプがWordPress以外の場合、もしくはWordPressの初期設定を行っていない場合は表示されない。
warm-up
Warm up HHVM by having it access itself a few times.
* Only available when using HHVM.
Command Line
kusanagi warm-up
Parameters
None
Example
# kusanagi warm-up http:/// ############ Done.
target [profile]
Change the target profile for “warm-up”, “bcache”, and “update” commands.
Command Line
kusanagi target [profile]
Parameters
profile
Example
パラメータを省略すると、カレントプロファイルを表示します。
# kusanagi target saya Done.
プロファイルを指定すると、指定したプロファイルをカレントプロファイルとして設定します。
このとき存在しないプロファイル、初期設定を行っていないプロファイルを指定しても、設定に失敗します。
# kusanagi target saya Target is changed to saya Done.
update [plugin|cert {profile}]
Update KUSANAGI WordPress plugins or SSL Certificate of Let’s Encrypt.
Command Line
kusanagi update plugin
kusanagi update cert kusanagi_html
Parameters
plugin | cert {profile}
Example
カレントプロファイルのプラグインを更新します。プラグインが最新版の時は、何もしません。
# kusanagi update plugin Done.
カレントプロファイルもしくは指定したプロファイルの、Let’s Encrypt SSL証明書を更新します。
Let’s Encrypt SSL証明書を発行していないときは、何もしません。
# kusanagi update cert kusanagi Done.
remove [-y] [profile]
KUSANAGIで使用するプロファイルを削除します。このコマンドは、設定ファイル、DocumentRootの内容、データベースを削除します。
Command Line
kusanagi remove
kusanagi remove -y kusanagi_html
Parameter
[-y] | -y を指定しない場合、設定ファイル、DocumentRoot、データベースを削除する際に、y/nを入力します。 -y を指定する場合、y/n を入力することなくすべて削除します。 |
---|---|
[profile] | profileを指定した場合、指定したプロファイルを削除します。profileを指定しない場合は、カレントプロファイルを削除します。Delete the profile after designated a new profile. |
Example
# kusanagi remove kusanagi_html Remove kusanagi_html config files ? [y/n] y Remove /home/kusanagi/kusanagi_html ? [y/n] y Remove kusanagi_html database ? [y/n] y Done.
nginx
Switch to using nginx. Restart nginx by this command if nginx is already working.
Command Line
kusanagi nginx
Parameter
None
Example
# kusanagi nginx use nginx Removed symlink /etc/systemd/system/multi-user.target.wants/httpd.service. Created symlink from /etc/systemd/system/multi-user.target.wants/nginx.service to /usr/lib/systemd/system/nginx.service. Done.
httpd
Switch to using Apache.
Command Line
kusanagi httpd
Parameters
None
Example
# kusanagi httpd use httpd Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details. Removed symlink /etc/systemd/system/multi-user.target.wants/nginx.service. Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service. Done.
hhvm
Switch to using HHVM.
Command Line
kusanagi hhvm
Parameters
None
Example
# kusanagi hhvm use hhvm Removed symlink /etc/systemd/system/multi-user.target.wants/php7-fpm.service. Created symlink from /etc/systemd/system/multi-user.target.wants/hhvm.service to /etc/systemd/system/hhvm.service. Done.
php8
Switch to using PHP8. Restart PHP8 this command if PHP8 is already working.
Command line
kusanagi php8
Parameter
None
Example
# kusanagi php8 use php8 Removed symlink /etc/systemd/system/multi-user.target.wants/php-fpm.service. Created symlink from /etc/systemd/system/multi-user.target.wants/php8-fpm.service to /usr/lib/systemd/system/php8-fpm.service. Done.
php7
Switch to using PHP7. Restart PHP7 this command if PHP7 is already working.
Command line
kusanagi php7
Parameter
None
Example
# kusanagi php7 use php7 Removed symlink /etc/systemd/system/multi-user.target.wants/php-fpm.service. Created symlink from /etc/systemd/system/multi-user.target.wants/php7-fpm.service to /usr/lib/systemd/system/php7-fpm.service. Done.
php-fpm
Switch to using php-fpm.
Command Line
kusanagi php-fpm
Parameters
None
Example
# kusanagi php-fpm use php-fpm Removed symlink /etc/systemd/system/multi-user.target.wants/hhvm.service. Created symlink from /etc/systemd/system/multi-user.target.wants/php-fpm.service to /usr/lib/systemd/system/php-fpm.service. Done.
restart
Restart the enabled services those KUSANAGI provides(nginx, Apache, HHVM, php8, php7, php5)
Command Line
kusanagi restart
Parameter
no
Example
# kusanagi restart Done.
bcache
Turn on, off or clear bcache.
Command Line
kusanagi bcache [on|off|clear]
Parameters
on | Turn on bcache. |
---|---|
off | Turn off bcache. |
clear | Clear bcache. |
fcache
Turn on, off and clear for fcache. Turning on will switch to Nginx.
Command Line
kusanagi fcache [on|off|clear]
Parameters
on | Turn on fcache. Will switch to nginx. |
---|---|
off | Turn off fcache. |
clear | Clear fcache. |
configure
Optimize the settings of KUSANAGI.
Run in case of an instance change after setting up KUSANAGI.
Command Line
kusanagi configure
Parameters
None
setting --fqdn FQDN [profile]
(KUSANAGI 7.8.2 or higher)
Change the host name during provision.
Command Line
kusanagi setting --fqdn host.example.com saya
Parameters
--fqdn | Specific host name with FQDN(Fully Qualified Domain Name). |
---|---|
profile | Input profile name.Skip this procedure to continue using current profile. |
setting --fqdn FQDN [profile]
provision 時に指定したホスト名(FQDN)を変更します。
Command Line
kusanagi setting --fqdn host.example.com saya
Parameter
--fqdn | 変更するホスト名をFQDN(Fully Qualified Domain Name)で指定します |
---|---|
profile | 対象のプロファイルを入力します。省略時はカレントプロファイルを使用します。 |
ssl [options] [profile]
Configure SSL related settings for current profile or specified profile.
Command Line
kusanagi ssl --email john@example.com saya
Parameter
--email email address | It will issue SSL certificate of Let’s Encrypt. Enter the email address to use for contact from Let’s Encrypt. When SSL certificate of Let’s Encrypt is successfully issued, it activates automatic update of SSL certificate. |
---|---|
--cert [Certificate file] --key [key file] | Copies the specified certificate file and key file and sets it as SSL certificate. The options --cert and --key must be set at the same time. This option can not be used with option --email at the same time. |
--https [redirect|noredirect] | Configure 301 redirect for HTTP to HTTPS. After specifying redirect, activate the sending of a header directing 301 permanent redirects. Once you specify noredirect, you enable sending 301 headers directing 301 permanent redirects. |
--hsts [off|weak|mid|high] | HSTS(HTTP Strict Transport Security)の設定を有効にします。 off : Disable HSTS. weak: Enable HSTS. (It does not include the subdomain of the specified host name (FQDN).) mid : Enable HSTS. (Includes the subdomain of the specified host name (FQDN), not using the preload HSTS.) high: Enable HSTS. (Includes the subdomain of the specified host name (FQDN), use Preload HSTS.) When setting high (using Preload HSTS), register the domain name in HSTS Preload list registration site . In order to set it from “high” once, in order to set it other than “high”, it is necessary not only to change the setting with the option --hsts but also to cancel preload HSTS registration on a mail basis. For details, refer to the item “Removal” of HSTS Preload List Registration Site . |
--auto [on|off] | Enable / disable automatic updating of certificate of Let’s Encrypt. If on is specified, Let’s Encrypt’s automatic certificate renewal is enabled. If off is specified, invalidate certificate automatic updating of Let’s Encrypt. This option will not do anything if you are not using a Let’s Encrypt certificate. |
profile | Enter the target profile. When it is omitted, the current profile is used. |
https [redirect|noredirect]
(KUSANAGI 7.8.2 or higher)
Enable or disable the permanent redirect (301) to HTTPS from HTTP.
Command Line
kusanagi https redirect
Parameters
redirect | Enable the permanent redirect 301 |
---|---|
noredirect | Disable the permanent redirect 301 |
autorenewal [on|off]
(KUSANAGI 7.8.2 or higher)
Enable or disable the auto-renewal of Let’s Encrypt certificates
Command Line
kusanagi autorenewal off
Parameters
on | Enable auto-renewal |
---|---|
off | Disable auto-renewal (Run this command to use an OV or EV SSL certificate) |
images [options] [profile]
Optimize JPEG/PNG files below the sepecified directories. Use this command to reduce the size of existing JPEG/PNG files. Replace the image size, quality, number of colors, etc. for files with the following extensions jpg, jpeg, JPG, JPEG, png, PNG.
kusanagi images --dir wp-contents/uploads --quality 80 --resize 1280x1024 --color 256 --user kusanagi:kusanagi --mode 0644
Command Line
kusanagi images saya
Parameters
--dir|--directory directory1[:directory2:…] | Specify the target directory. To specify multiple directories, separate them with “:”. Both absolute and relative paths can be specified as directories. If the directory name is relative, it is relative to the profile directory (/home/kusanagi/profile_name/Document‐ Root). If you omit the directory name as an argument, or if you do not specify this option, Specity wp-contents/uploads as the target directory. kusnagi images --dir /home/kusanagi/kusanagi_html/DocumentRoot/wp-contents/themes:wp-contents/uploads saya |
---|---|
--jpg|--jpeg | It targets JPEG files (files with extension .jpg, .jpeg, .JPG, .JPEG). If both the --png option is specified or both options are not specified, both JEPG file and PNG file are targeted. |
--png | It targets PNG files (files with extension .png, .PNG). If both the --jpeg|--jpeg option is specified or both options are not specified, both JEPG file and PNG file are targeted. |
--verbose | Displays the name of the directory being processed, the content of the processing, the name of the file being processed, and so on. If this option is not specified, only the processing content is output. Please note that a large amount of output will be displayed if there is a large number of files in the target directory. |
--quality[1-100] | Specify the quality of JPEG file and PNG file. You can specify a number from 1-100 after the option --quarity. If you do not specify the number, 80 is used. If this option is specified, --resize and --color option operations are not performed unless options are specified at the same time. If you do not specify the option --quarity, --resize, or --color, it behaves the same as specifying --quarity 80. |
--resize[WIDTHxHIGHT] | Specify the maximum size of JPEG/PNG file and resize the image larger than the specified size while keeping the aspect ratio to the specified size. You can specify width (number) x height (number) after option --resize. If you do not specify the value, 1280 x 1024 is used. If this option is specified, --quarity and --color option operations are not per‐ formed unless options are specified at the same time. If you do not specify the option --quarity, --resize, or --color, it behaves the same as specifying --resize 1280×1024. |
--color[1-256] | Convert PNG files’s colors to the specified number of index colors. You can specify a number (1-256) after option --color. If you do not specify the number, 256 is used. If this option is specified, --quarity and --resize option operations are not performed unless options are specified at the same time. If you do not specify the option --quarity, --resize, or --color, it behaves the same as specifying --color 256. |
--strip | Delete comment data (ex. EXIF information) of the JPEG files and reduce the file size. |
--owneruser[:group] | Execution of kusanagi images rewrites the owner of the target files. This option sets the owner to replace. When group specifying aftter “:”, Set the group to replace at the same time. If this option is not specified, kusanagi: kusanagi will be used as the owner and group. |
--mode [octet_value] | Execution of kusanagi images rewrites the permissions of the target files. This option sets the permission to replace to an octal number (ex. 0644). If this option is not speci‐ fied, 0644 is used as the permission. |
profile | Input profile name.Skip this procedure to continue using current profile. |
zabbix [on|off]
Configure the use of Zabbix Version 2.2 agent.
This is an advanced command. You need a separate Zabbix server in order to run it.
Command Line
kusanagi zabbix on
Parameters
on | Activates and boots Zabbix Version 2.2 agent |
---|---|
off | Shuts down Zabbix Version 2.2 agent |
monit [on|off|config]
(KUSANAGI 7.8.3 or higher)
Enable or disable system monitoring with monit. On is setting by default.
Command Line
kusanagi monit on
no parameter | Show the current status of monit(on/off) |
---|---|
on | enable monit |
off | disable monit |
config | create the configuration file of monit |