Installing Neo4j

Neo4j is a graph database management system. To install Neo4j Community Edition, update your Homestead.yaml file with the following configuration option:

neo4j: true
The default Neo4j installation will set the database username to homestead and corresponding password to secret. To access the Neo4j browser, visit http://homestead.test:7474 via your web browser. The ports 7687 (Bolt), 7474 (HTTP), and 7473 (HTTPS) are ready to serve requests from the Neo4j client.

なんだこれ、聞いたことねーぞ
サイトを見てみる。

The Neo4j Graph Platform – The #1 Platform for Connected Data

ああ、好きな人は好きだよね。これ。とりあえず進もう。
Aliases
You may add Bash aliases to your Homestead machine by modifying the aliases file within your Homestead directory:

alias c=’clear’
alias ..=’cd ..’
After you have updated the aliases file, you should re-provision the Homestead machine using the vagrant reload –provision command. This will ensure that your new aliases are available on the machine.
これでやっと半分くらい。

Daily Usage
Accessing Homestead Globally
Sometimes you may want to vagrant up your Homestead machine from anywhere on your filesystem. You can do this on Mac / Linux systems by adding a Bash function to your Bash profile. On Windows, you may accomplish this by adding a “batch” file to your PATH. These scripts will allow you to run any Vagrant command from anywhere on your system and will automatically point that command to your Homestead installation:

Mac / Linux
function homestead() {
( cd ~/Homestead && vagrant $* )
}
Make sure to tweak the ~/Homestead path in the function to the location of your actual Homestead installation. Once the function is installed, you may run commands like homestead up or homestead ssh from anywhere on your system.

Windows
Create a homestead.bat batch file anywhere on your machine with the following contents:

Make sure to tweak the example C:\Homestead path in the script to the actual location of your Homestead installation. After creating the file, add the file location to your PATH. You may then run commands like homestead up or homestead ssh from anywhere on your system.
うん、OK

Connecting Via SSH
You can SSH into your virtual machine by issuing the vagrant ssh terminal command from your Homestead directory.

But, since you will probably need to SSH into your Homestead machine frequently, consider adding the “function” described above to your host machine to quickly SSH into the Homestead box.
ssh接続のportは22でしたね。

scp
SSHを使用してリモートホストとの間でファイルを転送を行う。
ssh-keygen
公開鍵認証方式で使用するキーペアを生成する。
ssh-copy-id
公開鍵をリモートホストに登録するコマンド。環境によってはインストールされていない場合がある。

Connecting To Databases
A homestead database is configured for both MySQL and PostgreSQL out of the box. For even more convenience, Laravel’s .env file configures the framework to use this database out of the box.

To connect to your MySQL or PostgreSQL database from your host machine’s database client, you should connect to 127.0.0.1 and port 33060 (MySQL) or 54320 (PostgreSQL). The username and password for both databases is homestead / secret.

mysqlは33060のよう。
Port 33060 Details
https://www.speedguide.net/port.php?port=33060
33060 udp games Wolfenstein uses ports 33060-33070, developer: Raven Software SG
33060 tcp mysqlx MySQL Database Extended Interface (IANA official)
あ、こりゃすげーわ。

Database Backups
Homestead can automatically backup your database when your Vagrant box is destroyed. To utilize this feature, you must be using Vagrant 2.1.0 or greater. Or, if you are using an older version of Vagrant, you must install the vagrant-triggers plug-in. To enable automatic database backups, add the following line to your Homestead.yaml file:

backup: true
Once configured, Homestead will export your databases to mysql_backup and postgres_backup directories when the vagrant destroy command is executed. These directories can be found in the folder where you cloned Homestead or in the root of your project if you are using the per project installation method.

Adding Additional Sites
Once your Homestead environment is provisioned and running, you may want to add additional Nginx sites for your Laravel applications. You can run as many Laravel installations as you wish on a single Homestead environment. To add an additional site, add the site to your Homestead.yaml file:

sites:
– map: homestead.test
to: /home/vagrant/code/Laravel/public
– map: another.test
to: /home/vagrant/code/another/public
If Vagrant is not automatically managing your “hosts” file, you may need to add the new site to that file as well:

192.168.10.10 homestead.test
192.168.10.10 another.test
Once the site has been added, run the vagrant reload –provision command from your Homestead directory.

Site Types
Homestead supports several types of sites which allow you to easily run projects that are not based on Laravel. For example, we may easily add a Symfony application to Homestead using the symfony2 site type:

sites:
– map: symfony2.test
to: /home/vagrant/code/Symfony/web
type: “symfony2”
おう、なんかsymfonyやたらでてくんなー

Elasticsearchを入れよう

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.4.0.tar.gz
tar -xzf elasticsearch-6.4.0.tar.gz

おお、elasticsearchが入ってる。なんか感動。

cd elasticsearch-6.4.0

[vagrant@localhost elasticsearch-6.4.0]$ bin/elasticsearch-plugin install analysis-kuromoji
-> Downloading analysis-kuromoji from elastic
[=================================================] 100%  
-> Installed analysis-kuromoji

[vagrant@localhost elasticsearch-6.4.0]$ bin/elasticsearch
OpenJDK 64-Bit Server VM warning: If the number of processors is expected to increase from one, then you should configure the number of parallel GC threads appropriately using -XX:ParallelGCThreads=N
OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x00000000c5330000, 986513408, 0) failed; error=’Cannot allocate memory’ (errno=12)
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 986513408 bytes for committing reserved memory.
# An error report file with more information is saved as:
# logs/hs_err_pid17300.log

なにいいいいいいいいいいいいいいい

yum search openjdk

yum search openjdkでjavaのリスト一覧を出します。

jdkをインストールします。
sudo yum install java-1.8.0-openjdk

[vagrant@localhost app]$ java -version
openjdk version “1.8.0_191”
OpenJDK Runtime Environment (build 1.8.0_191-b12)
OpenJDK 64-Bit Server VM (build 25.191-b12, mixed mode)

ぎゃあああああああああああああああああああああああああああ

laravel Elastic search

Installing Elasticsearch
To install Elasticsearch, add the elasticsearch option to your Homestead.yaml file and specify a supported version, which may be a major version or an exact version number (major.minor.patch). The default installation will create a cluster named ‘homestead’. You should never give Elasticsearch more than half of the operating system’s memory, so make sure your Homestead machine has at least twice the Elasticsearch allocation:

Elasticsearchとは?
Elasticsearch は Elastic 社が開発しているオープンソースの全文検索エンジン。
大量のドキュメントから目的の単語を含むドキュメントを高速に抽出することができる。
RESTful インターフェースを使って操作

Elasticsearch ドキュメントを保存・検索します。
Kibana データを可視化します。
Logstash データソースからデータを取り込み・変換します。
Beats データソースからデータを取り込みます。
X-Pack セキュリティ、モニタリング、ウォッチ、レポート、グラフの機能を拡張します。

java

MariaDBを使おう

MariaDBは、MySQL派生のオープンソースな関係データベース管理システム(RDBMS)
MariaDBの開発は、MySQLのオリジナルコードの作者でMySQL ABの創設者でもあるMichael “Monty” Wideniusにより、 現在オラクルによって所有されているMySQLをフォークして立ち上げられたプロジェクトにより行われている。
→ なんか凄いことになってるな。

リポジトリを設定する前に、バージョンを見てみる。
http://yum.mariadb.org/
10.3.4/ 2018-Jan-18 03:44:00 – Directory
10.3.5/ 2018-Feb-26 10:23:25 – Directory
10.3.6/ 2018-Feb-26 10:23:25 – Directory
10.3.7/ 2018-May-24 14:45:12 – Directory
10.3.8/ 2018-Jul-02 18:33:23 – Directory
10.3.9/ 2018-Aug-15 14:40:45 – Directory

おう、10.3.9が最新のようだ。

レポジトリを作る
sudo vi /etc/yum.repos.d/mariadb.repo
10.3.9で入れる。

[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.3.9/centos6-x86
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
enabled=1

maria dbを入れていきます。
sudo yum install MariaDB-devel MariaDB-client MariaDB-server

なんかすげーエラー出てきた。
とりあえず優先順位は然程高くないので放置

Laravel Per Project Installation

Instead of installing Homestead globally and sharing the same Homestead box across all of your projects, you may instead configure a Homestead instance for each project you manage. Installing Homestead per project may be beneficial if you wish to ship a Vagrantfile with your project, allowing others working on the project to vagrant up.

To install Homestead directly into your project, require it using Composer:

Once Homestead has been installed, use the make command to generate the Vagrantfile and Homestead.yaml file in your project root. The make command will automatically configure the sites and folders directives in the Homestead.yaml file.

Mac / Linux:

php vendor/bin/homestead make
Windows:

vendor\\bin\\homestead make
Next, run the vagrant up command in your terminal and access your project at http://homestead.test in your browser. Remember, you will still need to add an /etc/hosts file entry for homestead.test or the domain of your choice.
なるほど、vagrant構築手順か。

Installing MariaDB
If you prefer to use MariaDB instead of MySQL, you may add the mariadb option to your Homestead.yaml file. This option will remove MySQL and install MariaDB. MariaDB serves as a drop-in replacement for MySQL so you should still use the mysql database driver in your application’s database configuration:
MariaDBも使えるとのこと。使ったことないぞ。

box: laravel/homestead
ip: “192.168.10.10”
memory: 2048
cpus: 4
provider: virtualbox
mariadb: true

laravel Configuring Homestead

Setting Your Provider
The provider key in your Homestead.yaml file indicates which Vagrant provider should be used: virtualbox, vmware_fusion, vmware_workstation, parallels or hyperv. You may set this to the provider you prefer:

The folders property of the Homestead.yaml file lists all of the folders you wish to share with your Homestead environment. As files within these folders are changed, they will be kept in sync between your local machine and the Homestead environment. You may configure as many shared folders as necessary:
vagrantの設定です。

folders:
– map: ~/code/project1
to: /home/vagrant/code/project1

– map: ~/code/project2
to: /home/vagrant/code/project2

You may also pass any options supported by Vagrant’s Synced Folders by listing them under the options key:

folders:
– map: ~/code
to: /home/vagrant/code
type: “rsync”
options:
rsync__args: [“–verbose”, “–archive”, “–delete”, “-zz”]
rsync__exclude: [“node_modules”]
このへんもそうですね。

Configuring Nginx Sites
Not familiar with Nginx? No problem. The sites property allows you to easily map a “domain” to a folder on your Homestead environment. A sample site configuration is included in the Homestead.yaml file. Again, you may add as many sites to your Homestead environment as necessary. Homestead can serve as a convenient, virtualized environment for every Laravel project you are working on:

If you change the sites property after provisioning the Homestead box, you should re-run vagrant reload –provision to update the Nginx configuration on the virtual machine.

The Hosts File
You must add the “domains” for your Nginx sites to the hosts file on your machine. The hosts file will redirect requests for your Homestead sites into your Homestead machine. On Mac and Linux, this file is located at /etc/hosts. On Windows, it is located at C:\Windows\System32\drivers\etc\hosts. The lines you add to this file will look like the following:

192.168.10.10 homestead.test

etc/hosts の中身

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

なんじゃこりゃ。

Make sure the IP address listed is the one set in your Homestead.yaml file. Once you have added the domain to your hosts file and launched the Vagrant box you will be able to access the site via your web browser:

http://homestead.test

Launching The Vagrant Box
Once you have edited the Homestead.yaml to your liking, run the vagrant up command from your Homestead directory. Vagrant will boot the virtual machine and automatically configure your shared folders and Nginx sites.

To destroy the machine, you may use the vagrant destroy –force command.
あれ、homestead.yamlでvagrant upだっけ?boxファイルでなかった!?

bashコマンド

bash は、標準入力やファイルから読み込んだコマンドを実行する、 sh 互換のコマンド言語インタプリタ

[vagrant@localhost app]$ bash helloworl.sh
hello world!

なるほど、シェルを実行するコマンドね。

git checkout

git initします。
[vagrant@localhost app]$ git init
Initialized empty Git repository in /home/vagrant/local/app/.git/

[vagrant@localhost app]$ vi sample.txt
[vagrant@localhost app]$ cat sample.txt
Hello Git!

[vagrant@localhost app]$ git add sample.txt
[vagrant@localhost app]$ git commit -m “git checkout”
[master (root-commit) c4b426e] git checkout
Committer: vagrant
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly:

git config –global user.name “Your Name”
git config –global user.email you@example.com

If the identity used for this commit is wrong, you can fix it with:

git commit –amend –author=’Your Name

1 files changed, 1 insertions(+), 0 deletions(-)
create mode 100644 sample.txt

git branchを作成する。
[vagrant@localhost app]$ git branch branch1
[vagrant@localhost app]$ git branch branch2
[vagrant@localhost app]$ git branch
branch1
branch2
* master

[vagrant@localhost app]$ git checkout branch1
Switched to branch ‘branch1’
[vagrant@localhost app]$ git branch
* branch1
branch2
master
なるほど、checkoutはbranchの切り替えです。

[vagrant@localhost app]$ git checkout branch2
Switched to branch ‘branch2’
[vagrant@localhost app]$ cat sample.txt
Hello Git!

なるほど、なるほど。
最近なるほどが異常に増えた。

Laravel Homestead

Homesteadの意味がわからん。

>公式サイトを読んだ限りでは、仮想マシン上に、ほんの数分で、OS、Nginx、PHP5.5、MySQL、Postgres、Redis、Memcached等のLaravelアプリケーションを開発するための環境を提供してくれるツールだと記述されています
なに、osも?ってことは、dockerっというより、isoまで!?すげーな、最近のフレームワークは。

Laravel strives to make the entire PHP development experience delightful, including your local development environment. Vagrant provides a simple, elegant way to manage and provision Virtual Machines.
あ、vagrantって書いてます。

Laravel Homestead is an official, pre-packaged Vagrant box that provides you a wonderful development environment without requiring you to install PHP, a web server, and any other server software on your local machine. No more worrying about messing up your operating system! Vagrant boxes are completely disposable. If something goes wrong, you can destroy and re-create the box in minutes!
あ、なんだ、vagrant boxのことじゃん。box引っ張て来て、vagrant initするだけです。しかし、homesteadという名称がわかりにくい。

Homestead runs on any Windows, Mac, or Linux system, and includes the Nginx web server, PHP 7.3, PHP 7.2, PHP 7.1, PHP 7.0, PHP 5.6, MySQL, PostgreSQL, Redis, Memcached, Node, and all of the other goodies you need to develop amazing Laravel applications.
なぜapacheでない?? Nginx好きだなー

Ubuntu 18.04
Git
PHP 7.3
PHP 7.2
PHP 7.1
PHP 7.0
PHP 5.6
Nginx
Apache (Optional)
MySQL
MariaDB (Optional)
Sqlite3
PostgreSQL
Composer
Node (With Yarn, Bower, Grunt, and Gulp)
Redis
Memcached
Beanstalkd
Mailhog
Neo4j (Optional)
MongoDB (Optional)
Elasticsearch (Optional)
ngrok
wp-cli
Zend Z-Ray
Go
Minio

centosではなく、ubuntuです。Goもはいってる! beanstalkd, mailhog, neo4j, ngrok, wp-cli, minioは初めて見る。

setup
Before launching your Homestead environment, you must install VirtualBox 5.2, VMWare, Parallels or Hyper-V as well as Vagrant. All of these software packages provide easy-to-use visual installers for all popular operating systems.
To use the VMware provider, you will need to purchase both VMware Fusion / Workstation and the VMware Vagrant plug-in. Though it is not free, VMware can provide faster shared folder performance out of the box.
To use the Parallels provider, you will need to install Parallels Vagrant plug-in. It is free of charge.
Because of Vagrant limitations, The Hyper-V provider ignores all networking settings.
vagrantのプラグインか。

Once VirtualBox / VMware and Vagrant have been installed, you should add the laravel/homestead box to your Vagrant installation using the following command in your terminal. It will take a few minutes to download the box, depending on your Internet connection speed:

You may install Homestead by cloning the repository. Consider cloning the repository into a Homestead folder within your “home” directory, as the Homestead box will serve as the host to all of your Laravel projects:

homestead、ありました。
https://github.com/laravel/homestead

Once you have cloned the Homestead repository, run the bash init.sh command from the Homestead directory to create the Homestead.yaml configuration file. The Homestead.yaml file will be placed in the Homestead directory:

おおおおお、git checkoutが出てきた。
なんかきりねーぞ