1)仮想マシーンを作成
AWSの無料アカウントを取得したあと、EC2仮想マシーンを作成し、sshでログインためのpublic keyを生成します。
SUSE Linuxのインスタンスを作成し、うまくログインできなかったため、Amazon Linuxのインスタンスを作成した。
2)sshでログイン
Amazon Linuxのdefault userは「ec2-user」で、作成したpublic keyでログインできた。
3)rootパスワードの設定
sudo passwdで設定できた。
4)password方式でsshログイン
key方式は面倒のため、passwordでもsshログインできるように、rootになってから
vi /etc/ssh/sshd_config
「PasswordAuthentication yes」にして、sshdを再起動
/etc/init.d/sshd restart
5)新しいユーザーを追加、パスワードを設定
useradd {username}
passwd {username}
6)新しいユーザーがsudoを使えるように設定
visudo
2016年10月27日木曜日
2016年10月24日月曜日
cakephp2におけるHABTM関係要素の検索
ProjectとSkill, AreaはHABTMの関係となっています。Skill, AreaでProjectを検索するには、条件には「joins」を定義してあげないと、SQLがエラーになります。hasOne/hasMany/belongsToなら、不要ですが。
if ($this->request->is('post')) {
$areas = $this->request['data']['area'];
$skills = $this->request['data']['Project']['Skill'];
$industries = $this->request['data']['Project']['Industry'];//IndustryはhasMany Project
$opt_area = array('OR' => array('Area.id' => $areas));//OR条件検索
$opt_skill = array('OR' => array('Skill.id' => $skills));
$opt_industry = array('OR' => array('Industry.id' => $industries));
$opt = array($opt_area, $opt_skill, $opt_industry);//default AND条件検索
$this->Paginator->settings = array(
'conditions' => $opt,
'recursive' => 1,
'group' => array('Project.id'),
'joins' => array(
array('table' => 'areas_projects',
'alias' => 'AreasProject',
'type' => 'inner',
'conditions' => array(
'Project.id = AreasProject.project_id',
)
),
array(
'table' => 'areas',
'alias' => 'Area',
'type' => 'inner',
'conditions' => array(
'AreasProject.area_id = Area.id',
),
),
array('table' => 'skills_projects',
'alias' => 'SkillsProject',
'type' => 'inner',
'conditions' => array(
'Project.id = SkillsProject.project_id',
)
),
array(
'table' => 'skills',
'alias' => 'Skill',
'type' => 'inner',
'conditions' => array(
'SkillsProject.skill_id = Skill.id',
),
),
$projects = $this->Paginator->paginate('Project');
2016年10月14日金曜日
cloud9でmysql/phpmyadminの使用
シェルで
mysql-ctl start
phpmyadmin-ctl install
https://{app_address}/phpmyadmin にアクセス
mysql-ctl start
phpmyadmin-ctl install
https://{app_address}/phpmyadmin にアクセス
2016年9月10日土曜日
macのphpを7に更新
curl -s http://php-osx.liip.ch/install.sh | bash -s 7.0
sudo apachectl restartあるいは
brew search php@7
そして、install versionを選択する
brew install php@7.2
参考ページ:https://coolestguidesontheplanet.com/upgrade-php-on-osx/
https://qiita.com/yamatmoo/items/4ff2fe1785f771e67e08
2016年6月11日土曜日
concrete5をインストール
1)パッケージファイルをDL
2)Document RootにDLしたファイルを移す(フォルダー名はcon5と仮定)
3)web server processが書き込めるように、chmod -R 777 con5/packages/(con5/application/files/とcon5/application/config/も同じ)
3)web server(apache)を起動
4)mysqlを設定:
mysql -u root -p
CREATE DATABASE con5;
grant all on con5.* to user4con5@localhost identified by 'con5pw';
上記1行は下記3行と同じ
create user user4con5@'localhost';
SET PASSWORD FOR user4con5@'localhost' = PASSWORD('con5pw');
GRANT ALL ON con5.* TO user4con5@'localhost' ;
5)ブラウザーから「localhost/con5」にアクセス、指示通り実行
参考:http://documentation.concrete5.org/developers/installation/installation
Cloud9上concrete5をインストール方法は、以下を参考
https://concrete5.co.jp/blog/cloud9-concrete5
2)Document RootにDLしたファイルを移す(フォルダー名はcon5と仮定)
3)web server processが書き込めるように、chmod -R 777 con5/packages/(con5/application/files/とcon5/application/config/も同じ)
3)web server(apache)を起動
4)mysqlを設定:
mysql -u root -p
CREATE DATABASE con5;
grant all on con5.* to user4con5@localhost identified by 'con5pw';
上記1行は下記3行と同じ
create user user4con5@'localhost';
SET PASSWORD FOR user4con5@'localhost' = PASSWORD('con5pw');
GRANT ALL ON con5.* TO user4con5@'localhost' ;
5)ブラウザーから「localhost/con5」にアクセス、指示通り実行
参考:http://documentation.concrete5.org/developers/installation/installation
Cloud9上concrete5をインストール方法は、以下を参考
https://concrete5.co.jp/blog/cloud9-concrete5
2016年6月9日木曜日
apacheをmac上起動
sudo apachectl start
apacheの設定file /private/etc/apache2/httpd.conf
web内容のフォルダー /Library/WebServer/Documents、上記設定ファイルを変更することによって、web rootを変更できる
停止 sudo apachectl stop
再起動 sudo apachectl restart
apacheの設定file /private/etc/apache2/httpd.conf
web内容のフォルダー /Library/WebServer/Documents、上記設定ファイルを変更することによって、web rootを変更できる
停止 sudo apachectl stop
再起動 sudo apachectl restart
2016年6月8日水曜日
mysqlをMacにインストール
1)dmgファイルをインストール
2)システム環境設定に「MySQL」が出来上がる、そこからmysqlを起動できる
3)初期passwordを変更
mysqladmin password NEWPW -u root -p
初期passwordを入力したら、NEWPWに変更される
2)システム環境設定に「MySQL」が出来上がる、そこからmysqlを起動できる
mysqladmin password NEWPW -u root -p
初期passwordを入力したら、NEWPWに変更される
登録:
投稿 (Atom)