- VirtualBox メニューの [デバイス] > [共有フォルダー設定]
- Windows (Host OS) に共有フォルダーを作成する (ユーザー\vbox_share)
- フォルダ追加アイコンを押す
- フォルダーのパス = 2. で作成したフォルダ
自動マウント = On
永続化する = On - マウントする
# mkdir /mnt/vbox_share # mount -t vboxsf vbox_share /mnt/vbox_share
- 動作確認
- Windows 側の vbox_share フォルダにファイルを置く
- CentOS で /mnt/vbox_share の中身を確認する
$ ls /mnt/vbox_share test.txt
- 起動時に自動マウントするように /etc/rc.local にマウントコマンドを追記する(★が追記箇所)
#!/bin/sh # # This script will be executed *after* all the other init scripts. # You can put your own initialization stuff in here if you don't # want to do the full Sys V style init stuff. touch /var/lock/subsys/local mount -t vboxsf vbox_share /mnt/vbox_share ★
2015年4月23日木曜日
[CentOS][VirtualBox]共有フォルダー作成
[CentOS][VirtualBox]GNOME インストール
- インストール & 起動
# yum groupinstall "X Window System" "GNOME Desktop Environment" "Desktop" $ startx
- GNOME インストール前に Guest Additions をインストールしていると X Window system 関連のインストールがスキップされているので、再インストールする
- GNOME terminal のフォントがずれているので修正する
【修正前】

【修正後】

DejaVu Sans Mono フォントをインストールする# yum -y install dejavu-sans-mono-fonts
[CentOS][VirtualBox]Virtual Box Guest Additions インストール
- kernel の update、gcc, make, kernel-devel をインストールする
# yum -y update kernel # yum -y install gcc make kernel-devel
- 再起動
- Guest Additions CD をマウントする
# mkdir /mnt/cdrom # mount -r /dev/cdrom /mnt/cdrom
- Guest Additions CD のインストーラーをを実行する
# cd /mnt/cdrom # ./VBoxLinuxAdditions.run
[CentOS][VirtualBox]ifconfig を実行すると eth0 が起動していない
- 起動時の設定ファイル /etc/sysconfig/network-scripts/ifcfg-eth0 を修正する
【変更前】ONBOOT=no
【変更後】ONBOOT=yes
- ネットワークを再設定
# /etc/inet.d/network restart
2015年4月2日木曜日
[PowerShell]ディレクトリ一覧を取得し、ディレクトリに対して作業をする
$directories = @(Get-ChildItem | Where-Object {$_.Attributes -eq "Directory"})
Write-Debug "$directories"
foreach ($d in $directories) {
convertFiles($d)
compressZip($d)
}
| Cmdlet | Description |
|---|---|
| Where-Object | オブジェクトの配列をフィルタにかけ、条件に一致するオブジェクトだけを出力する |
Get-ChildItem | Where-Object {$_.Attributes -eq "Directory"}
[PowerShell]7-zipを使ってzip圧縮する
###################################
# ZIP 圧縮
###################################
function compressZip([string] $directory)
{
Set-Alias sz "C:\Program Files\Utility\7-Zip\7z.exe"
$output = $directory + ".zip"
sz a $output $directory
}
| Cmdlet | Description |
|---|---|
| Set-Alias | エイリアスを作成する |
[PowerShell]指定ディレクトリ内のjpgファイルにconvertコマンドを実行する
##########################################################
# 指定ディレクトリ内の jpg ファイルに対しサイズ変換をする
##########################################################
function convertFiles([string] $directory)
{
Set-Location $directory
Write-Debug "Search jpg files in $directory"
$files = @(Get-ChildItem .\*.* -Include *.jpg -Name)
Write-Debug "$files"
foreach ($f in $files) {
Write-Debug "convert.exe $f -strip -density 300x300 -units PixelsPerInch -geometry 50% $f"
convert.exe $f -strip -density 300x300 -units PixelsPerInch -geometry 50% $f
}
Set-Location ..
}
| Cmdlet | Description |
|---|---|
| Set-Location | 作業場所を指定する。cdと同等 |
| Write-Debug | デバッグメッセージをコンソールに出力する |
| Get-ChildItem | 指定された場所から項目および子項目を取得する。lsと同等 -Include: 指定された項目だけ取得する -Name: 指定された場所にある項目の名前だけを取得します |
登録:
コメント (Atom)