<commit_before>---
layout: post
title:  "2019 aws 勉強資料"
date:   2019-02-14
category: aws
tags: [aws]
---

## 参考資料

- [aws web](https://aws.amazon.com/jp/) - aws web

- [CentOS 7インスタンス](https://dev.classmethod.jp/cloud/aws/centos7-initial-settings/) - CentOS 7インスタンス


## 自分環境





## 設定

1. VPCの設定

![EC2設定](https://raw.githubusercontent.com/meihaoGit/meihaoGit.github.io/master/assets/images/img/ec2setting.jpg)

2. EC2作成
    Centos7
    ※ Amazon Linuxを使用しているのでデフォルトのユーザはec2-userです。
       CentOS：centos#root
    
3. Centos7初期化   

- CentOS 7インスタンス

```sh
$sudo yum -y update

$sudo yum -y install autoconf

$sudo yum -y install curl-devel expat-devel gettext-devel openssl-devel zlib-devel perl-ExtUtils-MakeMaker gcc

$sudo localectl set-locale LANG=ja_JP.utf8

$sudo localectl set-keymap jp106

$sudo timedatectl set-timezone Asia/Tokyo

$systemctl list-unit-files --type service | grep enabled

$sudo systemctl stop postfix.service
$sudo systemctl disable postfix.service

```

- Webサーバのインストールと起動設定

```sh

$sudo yum -y install httpd

$sudo systemctl start httpd.service

$sudo systemctl enable httpd.service

sudo adduser ec2webapusr

sudo su - ec2webapusr

mkdir .ssh

chmod 700 .ssh

touch .ssh/authorized_keys


sudo userdel -r centos

```

- 新ユーザ作成

```sh

$sudo su -
# passwd

$sudo adduser ec2webapusr

#passwd ec2webapusr
#usermod -G wheel ec2webapusr

$sudo su - ec2webapusr

$mkdir .ssh

$chmod 700 .ssh

$touch .ssh/authorized_keys

$vi .ssh/authorized_keys
.pem text add 

$sudo userdel -r centos

```
- ユーザ権限設定
----

visudo

 88 ## Allows people in group wheel to run all commands
 89 # %wheel ALL=(ALL) ALL
 90
 91 ## Same thing without a password
 92 # %wheel ALL=(ALL) NOPASSWD: ALL
 
----

- wget install

```

$sudo yum install --downloadonly --downloaddir=/tmp wget
$cd /tmp
$sudo rpm -ivh wget-1.14-18.el7.x86_64.rpm

```

- git install

```

$cd ~
$wget https://www.kernel.org/pub/software/scm/git/git-2.20.1.tar.gz
$ make configure
$ ./configure --prefix=/usr
$ make all
$ sudo make install

```<commit_msg>fix layout<commit_after>---
layout: post
title:  "2019 aws 勉強資料"
date:   2019-02-14
category: aws
tags: [aws]
---

## 参考資料

- [aws web](https://aws.amazon.com/jp/) - aws web

- [CentOS 7インスタンス](https://dev.classmethod.jp/cloud/aws/centos7-initial-settings/) - CentOS 7インスタンス


## 自分環境





### 設定

#### 1. VPCの設定

![EC2設定](https://raw.githubusercontent.com/meihaoGit/meihaoGit.github.io/master/assets/images/img/ec2setting.jpg)

#### 2. EC2作成
    Centos7
    ※ Amazon Linuxを使用しているのでデフォルトのユーザはec2-userです。
       CentOS：centos#root
    
#### 3. Centos7初期化   

- CentOS 7インスタンス

```sh
    $sudo yum -y update

    $sudo yum -y install autoconf

    $sudo yum -y install curl-devel expat-devel gettext-devel openssl-devel zlib-devel perl-ExtUtils-MakeMaker gcc

    $sudo localectl set-locale LANG=ja_JP.utf8

    $sudo localectl set-keymap jp106

    $sudo timedatectl set-timezone Asia/Tokyo

    $systemctl list-unit-files --type service | grep enabled

    $sudo systemctl stop postfix.service
    $sudo systemctl disable postfix.service

```

- Webサーバのインストールと起動設定

```sh

$sudo yum -y install httpd

$sudo systemctl start httpd.service

$sudo systemctl enable httpd.service

sudo adduser ec2webapusr

sudo su - ec2webapusr

mkdir .ssh

chmod 700 .ssh

touch .ssh/authorized_keys


sudo userdel -r centos

```

- 新ユーザ作成

```sh

$sudo su -
# passwd

$sudo adduser ec2webapusr

#passwd <PASSWORD>
#usermod -G wheel ec2webapusr

$sudo su - ec2webapusr

$mkdir .ssh

$chmod 700 .ssh

$touch .ssh/authorized_keys

$vi .ssh/authorized_keys
.pem text add 

$sudo userdel -r centos

```
- ユーザ権限設定

---

visudo

 88 ## Allows people in group wheel to run all commands
 89 # %wheel ALL=(ALL) ALL
 90
 91 ## Same thing without a password
 92 # %wheel ALL=(ALL) NOPASSWD: ALL
 
---

- wget install

```

$sudo yum install --downloadonly --downloaddir=/tmp wget
$cd /tmp
$sudo rpm -ivh wget-1.14-18.el7.x86_64.rpm

```

- git install

```

$cd ~
$wget https://www.kernel.org/pub/software/scm/git/git-2.20.1.tar.gz
$ make configure
$ ./configure --prefix=/usr
$ make all
$ sudo make install

```
{'fraction_non_alphanumeric': 0.12660996354799514, 'fraction_numerical': 0.03134872417982989, 'mean_word_length': 3.2258726899383983, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 8, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1756264', 'n_tokens_mistral': 1925, 'n_tokens_neox': 1718, 'n_words': 413}