Skip to content

Instantly share code, notes, and snippets.

@hdknr
Last active August 29, 2015 14:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hdknr/78ae7456c0fc56d74b22 to your computer and use it in GitHub Desktop.
Save hdknr/78ae7456c0fc56d74b22 to your computer and use it in GitHub Desktop.
Windows Note

CentOS Virtual Box

  • CentOS6 (http://wiki.centos.org/Download) からISOを落とす
  • eth0 (NAT), eth1 (host-only)
  • リブートしても /etc/sysconfig/network-scripts/ifcfg-eth0(ethも) がONBOOT=no になっているので、=yesに変えて networking restart
  • これで 192.168.56.101(とか)のゲストにsshできる

yum

proxy=http://172.165.101.254:8080

curl

$ grep "^proxy" /etc/yum.conf  > ~/.curlrc
$ curl -I https://www.google.com
HTTP/1.0 200 Connection established

HTTP/1.1 302 Found
Cache-Control: private
Content-Type: text/html; charset=UTF-8
Location: https://www.google.co.jp/?gfe_rd=cr&ei=xEu4Vb60Msim8wf41YzgCg
Content-Length: 262
Date: Wed, 29 Jul 2015 03:43:00 GMT
Server: GFE/2.0
Alternate-Protocol: 443:quic,p=1

wget

$ grep "^proxy" /etc/yum.conf | sed -e "s/proxy/http_proxy/" > ~/.wgetrc
$ grep "^proxy" /etc/yum.conf | sed -e "s/proxy/https_proxy/" >> ~/.wgetrc

useradd

[root@centos6 ~]# useradd centos6
[root@centos6 ~]# grep centos6 /etc/passwd
centos6:x:500:500::/home/centos6:/bin/bash
[root@centos6 ~]# grep centos6 /etc/group
centos6:x:500:
[root@centos6 ~]# passwd centos6
ユーザー centos6 のパスワードを変更。
新しいパスワード:
よくないパスワード: 辞書の単語に基づいています
新しいパスワードを再入力してください:
passwd: 全ての認証トークンが正しく更新できました。

visudo

[root@centos6 ~]# visudo
[root@centos6 ~]# grep centos6 /etc/sudoers
centos6 ALL=(ALL)       NOPASSWD: ALL

git

[centos6@centos6 ~]$ export PROXY=$(grep "^proxy" /etc/yum.conf  | sed -r "s/^.+=//")
[centos6@centos6 ~]$ git config --global http.proxy $PROXY
[centos6@centos6 ~]$ git config --global https.proxy $PROXY
[centos6@centos6 ~]$ git config --global url."https://".insteadOf git://
[centos6@centos6 ~]$ git clone https://github.com/hdknr/bin.git
Initialized empty Git repository in /home/centos6/bin/.git/
remote: Counting objects: 650, done.
remote: Total 650 (delta 0), reused 0 (delta 0), pack-reused 650
Receiving objects: 100% (650/650), 84.32 KiB, done.
Resolving deltas: 100% (346/346), done.

tmux

[centos6@centos6 ~]$ sudo yum install gcc make automake pkgconfig wget git-core ncurses-devel
[centos6@centos6 ~]$ mkdir src && cd src
[centos6@centos6 src]$ wget https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz
[centos6@centos6 src]$ tar zxf libevent-2.0.21-stable.tar.gz && cd libevent-2.0.21-stable
[centos6@centos6 libevent-2.0.21-stable]$ ./configure && make
[centos6@centos6 libevent-2.0.21-stable]$ sudo make install
[centos6@centos6 libevent-2.0.21-stable]$ sudo ln -s /usr/local/lib/libevent-2.0.so.5 /usr/lib64
[centos6@centos6 ~]$ cd ~/src
[centos6@centos6 src]$ git clone https://github.com/tmux/tmux && cd tmux
[centos6@centos6 tmux]$ sh autogen.sh
[centos6@centos6 tmux]$ ./configure  && make
[centos6@centos6 tmux]$ sudo make install
[centos6@centos6 tmux]$ which tmux
/usr/local/bin/tmux

pip

export HTTP_PROXY=$(grep "^proxy" /etc/yum.conf  | sed -r "s/^.+=//")
export HTTPS_PROXY=$HTTP_PROXY

Vagrant

set http_proxy=172.165.101.1:8080
set https_proxy=172.165.101.1:8080

Chocolatey

  • PowerShell
Set-ExecutionPolicy Restricted
function Download-File {
param (
  [string]$url,
  [string]$file
 )
  Write-Host "Downloading $url to $file"
  $proxy = New-Object System.Net.WebProxy("172.165.101.21:8080", $true) ;
  $proxy.Credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials;
  
  $downloader = new-object System.Net.WebClient
  $downloader.UseDefaultCredentials = $true  
  $downloader.Proxy = $proxy  
  
  $downloader.DownloadFile($url, $file)
}
  • environment variables
[Environment]::SetEnvironmentVariable("http_proxy", "172.165.101.1:8080","Machine")
[Environment]::SetEnvironmentVariable("https_proxy", "172.165.101.1:8080","Machine")

VirtualBox

ホストマシンの仮想化支援機能(VT-x/AMD-V)が使用できません。64ビット ゲストOSは64ビットCPUを検出できず、起動できません。

HyperV が有効になっている。

C:\WINDOWS\system32>bcdedit /set hypervisorlaunchtype off
この操作を正しく終了しました。

再度有効にするには。

bcdedit /set hypervisorlaunchtype auto
@hdknr
Copy link
Author

hdknr commented Jul 29, 2015

mcrypt for CentOS 6

[centos6@centos6 ~]$ sudo rpm -ivh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm --httpproxy 172.165.101.254 --httpport 8080
http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm を取得中
警告: /var/tmp/rpm-tmp.o0thFH: ヘッダ V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
準備中...                ########################################### [100%]
   1:epel-release           ########################################### [100%]
# wget "http://dl.fedoraproject.org/pub/epel/6/x86_64/libmcrypt-2.5.8-9.el6.x86_64.rpm"
# wget "http://dl.fedoraproject.org/pub/epel/6/x86_64/libmcrypt-devel-2.5.8-9.el6.x86_64.rpm"
# yum localinstall libmcrypt-2.5.8-9.el6.x86_64.rpm libmcrypt-devel-2.5.8-9.el6.x86_64.rpm

@hdknr
Copy link
Author

hdknr commented Jul 29, 2015

phpenv

sudo yum install libxml2-devel -y
sudo yum install libcurl curl-devel -y
sudo yum install enchant-devel -y
sudo yum install libjpeg-devel -y
sudo yum install libpng-devel -y
sudo yum install libXpm-devel -y
sudo yum install freetype-devel -y
sudo yum install t1lib-devel -y
sudo yum install gmp-devel -y
sudo yum install libc-client-devel -y
sudo yum install libicu libicu-devel -y
sudo yum install net-snmp-devel
sudo yum install libtidy-devel
sudo yum install libxslt-devel -y
sudo yum install gettext-devel -y
sudo yum install libxslt-devel -y
sudo yum install gettext-devel -y
$ curl https://gist.githubusercontent.com/hdknr/78ae7456c0fc56d74b22/raw/5dd18669dc2a6de243e5fd80edf999beed5ca716/default_configure_options.txt > /tmp/opts.txt
$ cat /tmp/opts.txt >> /home/vagrant/.anyenv/envs/phpenv/plugins/php-build/share/php-build/default_configure_options

$ curl https://gist.githubusercontent.com/hdknr/78ae7456c0fc56d74b22/raw/5dd18669dc2a6de243e5fd80edf999beed5ca716/centos_rpm_for_phpenv.txt  > /tmp/rpm.txt

@hdknr
Copy link
Author

hdknr commented Jul 30, 2015

@hdknr
Copy link
Author

hdknr commented Jul 30, 2015

import requests
r = requests.get('http://github.com', allow_redirects=False)
print(r.status_code)

@hdknr
Copy link
Author

hdknr commented Jul 31, 2015

C:\> choco install python2
PS C:\tools\python2> setx PATH "$env:path;C:\tools\python2" -m

成功: 指定した値は保存されました。
  • pip でエラーおきたが、 python2インストールした時点で入っているのかも
C:\> choco install pip
PS C:\tools> setx PATH "$env:path;C:\tools\python2\Scripts" -m

成功: 指定した値は保存されました。
PS C:\tools>
C:\> pip install selenium
C:\> pip install beautifulsoup4

@hdknr
Copy link
Author

hdknr commented Jul 31, 2015

Chocolatey : The package was not found with the source(s) listed.

C:\Windows\system32>choco install git
Chocolatey v0.9.9.8
Installing the following packages:
git
By installing you accept licenses for the packages.
git not installed. The package was not found with the source(s) listed.
 If you specified a particular version and are receiving this message, it is possible that the package name exists but t
he version does not.
 Version: ""
 Source(s): "https://chocolatey.org/api/v2/"

Chocolatey installed 0/1 package(s). 1 package(s) failed.
 See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
Failures:
 - git
  • これは システムのインターネット接続でプロキシが正しく設定されていない、とかでリストが取れない時のエラー

@hdknr
Copy link
Author

hdknr commented Jul 31, 2015

$ grep "^http" ~/.wgetrc  | sed -r "s/^/export /" >> ~/.bash_extra/proxy.bash

@hdknr
Copy link
Author

hdknr commented Jul 31, 2015

@hdknr
Copy link
Author

hdknr commented Aug 1, 2015

@hdknr
Copy link
Author

hdknr commented Aug 3, 2015

http://no6.hatenablog.com/entry/2014/10/07/204528

# wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
# rpm --upgrade --verbose --hash rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
警告: rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm: ヘッダ V3 DSA/SHA1 Signature, key ID 6b8d79e6: NOKEY
準備中...                ########################################### [100%]
   1:rpmforge-release       ########################################### [100%]
# rpm --upgrade --verbose --hash rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
...
Warning: RPMDB altered outside of yum.
  Updating   : subversion-1.7.4-0.1.el6.rfx.x86_64                                                                                1/2
  Cleanup    : subversion-1.6.11-12.el6_6.x86_64                                                                                  2/2

Updated:
  subversion.x86_64 0:1.7.4-0.1.el6.rfx

Complete!
# svn --version
svn, バージョン 1.7.4 (r1295709)

@hdknr
Copy link
Author

hdknr commented Aug 6, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment