カテゴリー別アーカイブ: 未分類
保護中: Pythonを使って集客に役立てよう その2
保護中: Pythonを使って集客に役立てよう その1
ubuntu 16 プリンターのドライバーを設定
ubuntu 16.04で
ネットワークに接続されている
プリンター(epson プリンタ ep-903a)を
使用できるように、設定してみた
画面左上の電源マークのメニューの中から
システム設定>プリンター>
+追加 タブ
ネットワークプリンタ
Epson EP-903F(192.xxx.xxx.xxx)
接続
DNS-SD経由のLPDネットワークプリンタ
進む
( )ライセンスを受託します
チェック
進む
設定ができた。
ubuntu16.04 アーカイブマネージャ 文字化け
ubuntu16.04で、
アーカイブマネージにより、
ZIPファイルを解凍すると、ファイル名が文字化けすることがある。
~/.profileに
export UNZIP=”-O CP932″;export ZIPINFO=”-O CP932″
を追加し、再起動により、対策できた。
vim ~/.profile
G 文末へ移動
i 挿入モード
export UNZIP="-O CP932";export ZIPINFO="-O CP932"
esc :wq 上書き終了
参考:
http://roganpalm.com/20160424/1039-08/
Ubuntu fileZilla が固まった時
Ubuntu fileZilla が固まった時
端末から
> killall filezilla
で、強制終了にて対応できた。
Ubunt16にWordPressとレスポンシブルWebデザインテーマbizvektorを組み込んでみる
Ubunt16にWordPressと
レスポンシブルWebデザインテーマbizvektorを組み込んでみます
1,Apacheの組み込み
sudo apt -y install apache2
apache2 -v
Server version: Apache/2.4.18 (Ubuntu) Server built: 2016-07-14T12:32:26
apacheを起動する
sudo service apache2 start
Webで確認する
firefox localhost
cat <<EOF > /var/www/html/test.html <html> <hr> hello <hr> </html> EOF
bash: /var/www/html/test.html: 許可がありません
ローカルでなので、
sudo chmod 777 /var/www/html/
cat <<EOF > /var/www/html/test.html <html> <hr> hello <hr> </html> EOF curl 'http://localhost/test.html'
アクセスできた
<html> <hr> hello <hr> </html>
ブラウザでも確認
firefox localhost/test.html
2,PHPを組み込む
sudo apt -y install php
php -v
PHP 7.0.8-0ubuntu0.16.04.2 (cli) ( NTS ) Copyright (c) 1997-2016 The PHP Group Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies with Zend OPcache v7.0.8-0ubuntu0.16.04.2, Copyright (c) 1999-2016, by Zend Technologies
cat <<EOF > /var/www/html/phpinfo.php <?php phpinfo(); ?> EOF curl 'http://localhost/phpinfo.php'
firefoxで、アクセスしてみる
firefox localhost/phpinfo.php apacheの再起動を忘れた sudo service apache2 stop sudo service apache2 start
うまくいかない
firefox localhost/phpinfo.php パッケージを追加 sudo apt -y install libapache2-mod-php
firefox localhost/phpinfo.php
うまくいった。
3,mysqlをインストール
sudo apt -y install mysql-server php-mysql
Mysqlのrootのパスワードを聞かれるので、
入力しタブでスペースで、続行する(確認の2回あります)
mysql -u root -p
データベース(wordpress)を作成
wordpressというユーザを作成し、パスワードをwordpress2016とする
rootで入るので、先ほどのパスワードを入力する
mysql -u root -p Enter password: (先ほどのパスワード) create database wordpress; grant all privileges on wordpress.* to wordpress@localhost identified by 'wordpress2016'; flush privileges; exit;
4,WordPressをインストール
WordPressをダウンロードし
ファイルを解凍する
cd /tmp wget http://ja.wordpress.org/wordpress-3.8.1-ja.tar.gz tar zxvf wordpress-3.8.1-ja.tar.gz cp -r wordpress /var/www/html
sudo chown -R www-data:www-data /var/www/html/wordpress
firefox http://localhost/wordpress/
お使いのサーバーの PHP では WordPress に必要な MySQL 拡張を利用できないようです。
ライブラリィ−を追加してみる
sudo apt-get update sudo apt-get install php-curl php-gd php-mbstring php-mcrypt php-xml php-xmlrpc sudo service apache2 stop sudo service apache2 start firefox http://localhost/wordpress/
やはりだめ
お使いのサーバーの PHP では WordPress に必要な MySQL 拡張を利用できないようです。
WordPressのバージョンを上げてみる
cd /tmp sudo rm -rf /var/www/html/wordpress sudo rm -rf /tmp/wordpress wget http://ja.wordpress.org/latest-ja.tar.gz tar -xzvf latest-ja.tar.gz cp -r wordpress /var/www/html sudo chown -R www-data:www-data /var/www/html/wordpress firefox http://localhost/wordpress/
うまくいった。。。。
データベース名:wordpress
ユーザ名:wordpress
パスワード:wordpress2016
データベースのホスト名:localhost
テーブル接頭辞:wp_
「インストール続行」
サイトのタイトル:タイトル
ユーザー名:admin
パスワード:admin_password
パスワード:admin_password
メールアドレス:xxx@yyy.zz
「WordPressをインストール」
5,レスポンシブルWebデザインテーマbizvektorを組み込む
手順は
・テーマの読み込み
・推奨プラグインの読み込み(有効化)
・サンプルデータの読み込み
となります。
5.1 テーマの読み込み
BizVektor
https://bizvektor.com/
のダウンロードページ
https://bizvektor.com/bizvektor.com/about/download/
から、
Download BizVektor ver 1.8.23
を、ダウンロード
外観>テーマ>新規追加
「データのアップロード」
により
先ほど、ダウンロードしたファイルを「参照」で
指定し、
「今すぐインストール」
を、押下
外観>テーマ
選択し、
ダウンロードしたテーマ「BizVektor」
を、有効にしてください。
5.2 推奨プラグインの読み込み(有効化)
に従い、
「プラグイン」→「新規追加」画面より、『お気に入り』画面を表示。
「wordpress.orgユーザー名」のフォームに「bizvektor」と入力して、必要なプラグインをインストール。
インストールした、プラグインを有効化します
プラグインを追加する
5.3 サンプルデータの読み込み
BizVektor クイックスタート
のページの
「サンプルデータ」
を、ダウンロードする
ダウンロードしたデータを
bv_contents_corporate_v20140928.zip
解凍し、
bv_contents_corporate_v20140928.xml
のファイルを読み出す
コンテンツデータのダウンロード・インポート
に従い、コンテンツデータを、インポートする
「ツール」→「インポート」→「WordPress」でダウンロードしたxmlファイルを選択し、「ファイルをアップロードしてインポート」
これで、レスポンシブル対応のWordPressが立ち上がります。
■隘路(ポイント)
「お使いのサーバーの PHP では WordPress に必要な MySQL 拡張を利用できないようです。」
への対策
1,WordPressを最新にする
2,不足しているライブラィーを追加する
sudo apt-get install php-curl php-gd php-mbstring php-mcrypt php-xml php-xmlrpc
3,Apacheを再起動する
sudo service apache2 stop sudo service apache2 start
Redmine3.3とGitを連携する
Redmineのプラグイン
redmine_github_hook.git
を使って、GitとRedmineを連携してみました。
Redmineの配置場所を、
/var/lib/redmine
としますので、
それ以外の場合は、
/var/lib/redmine
の部分を書き換えて下さい
1,プラグインを組み込む
cd /var/lib/redmine/plugins git clone https://github.com/koppen/redmine_github_hook.git
2,Git側で、レポジトリーを作成
GitHubまたは、Gitbucketで、対象のレポジトリを作成
3,サーバ側設定
cd /var/lib/redmine/repo
GitHubの場合
git clone --bare https://github.com/<アカウント名>/<レポジトリ名>.git
Gitbucketの場合
git clone --bare https://<アカウント名>@bitbucket.org/<アカウント名>/<レポジトリ名>.git
キーを登録しSSHで接続する場合は
git clone --bare git@github.com:<アカウント名>/<レポジトリ名>.git
で、可能です。
4,Remindeの再起動し、プラグインを組み込む
cd /var/lib/redmine//tmp touch restart.txt
RedmineのWebでどこかの、画面をアクセスする(または、再表示)
(再起動しても、restart.txtは、消えない)
5,Redmineで、設定
プロジェクトの画面
設定>リポジトリ>新しいリポジトリ
バージョン管理システム:Git
識別子:わかりやすい文字を指定
リポジトリのパス:/var/lib/redmine/repo/<レポジトリ名>.git
パスのエンコーディング:UTF-8
識別子を設定により、
一つのプロジェクトで、識別子名による、切り替えができる
これにより、
Redmineから、
更新履歴、差分、コメントなどを、見ることがき、
更新内容と、Redmine内のチケットと連携(関係付ける)ことができます
6,Gitの最新の手動反映
Gitサーバ側のWebhookにより、
Gitサーバ側の更新時に、Redmineサーバの
更新内容を自動連携する方法がありますが、
以下により、手動反映ができました
cd /var/lib/redmine/repo rm -rf <レポジトリ名>.git git clone --bare https://github.com/<アカウント名>/<レポジトリ名>.git git clone --bare https://<アカウント名>@bitbucket.org/<アカウント名>/<レポジトリ名>.git
7,プラウザからGitの最新の反映
毎回端末で、接続して、反映するのが大変なため、
自動更新を行う
更新方法としては
Cronで行う方法もあるが、
ほどんど更新していないのに、
Gitサーバに問い合わせに行くのは、申し訳ない。
本来,Gitサーバ側で
Service Hooks:WebHook
で、設定を行えばいいのだが、
Redmine側から取りに行く方法で行ってみた。
phpから、Shellを起動してみる
7,1 phpのインストール
phpがあるか確認
php --version -bash: php: コマンドが見つかりません
ないので、phpのインストール
参考:
http://qiita.com/ozawan/items/caf6e7ddec7c6b31f01e
yum install --enablerepo=remi,remi-php56 php php-devel php-mbstring php-pdo php-gd /etc/rc.d/init.d/httpd stop /etc/rc.d/init.d/httpd start
7.2 phpで、shellを起動
参考:
http://php.net/manual/ja/function.shell-exec.php
cat <<EOF > /var/lib/redmine/public/ls.php <?php $output = shell_exec('ls -lart'); echo "<pre>$output</pre>"; ?> EOF
xx.xx.xx/ls.php
で、表示を確認
7.3 phpで、gitを起動するプログラムを作成
repoの所有者を変更
chown -R apache:apache /var/lib/redmine/repo
cat <<EOF > /var/lib/redmine/public/git_change.php <?php shell_exec('rm -rf /var/lib/redmine/repo/<レポジトリ名>.git'); $output = shell_exec('git clone --bare https://github.com/<アカウント名>/<レポジトリ名>.git'); shell_exec('mv /var/lib/redmine/public/<レポジトリ名>.git /var/lib/redmine/repo/<レポジトリ名>.git'); echo "<pre>$output</pre>"; ?> EOF
同期したいときに
ブラウザから
xx.xx.xx/git_change.php
で、最新情報を読み取る
8 ファイル、フォルダの日本語対応
Redmineサーバ側のGitのバージョンを上げる
CentOS 8.7
の場合、Gitのバージョンは 1.7.1
最新にバージョンを上げる
参考
バージョンを確認する
git --version git version 1.7.1
パッケージを読み込む
yum -y install curl-devel expat-devel gettext-devel openssl-devel zlib-devel perl-ExtUtils-MakeMaker
ソースを読み込み、インストールする
cd wget https://www.kernel.org/pub/software/scm/git/git-2.4.0.tar.gz tar zxvf git-2.4.0.tar.gz cd git-2.4.0 make prefix=/usr/local all make prefix=/usr/local install . ~/.bash_profile git --version git version 2.4.0
最新を読み込み、インストールする
cd /usr/local/src/ git clone git://git.kernel.org/pub/scm/git/git.git cd git make prefix=/usr/local all make prefix=/usr/local install git --version git version 2.9.2.574.gc6b0597
Redmineを再起動する
cd /var/lib/redmine/tmp rm restart.txt touch restart.txt /etc/rc.d/init.d/httpd restart
参考
http://qiita.com/n_slender/items/54cd282c140fadbbb322
http://symfoware.blog68.fc2.com/blog-entry-1694.html
ConoHaでCentOS6.7へRedmine3.3をインストールする
1,パッケージインストール
1 |
yum -y install git gcc gcc-c++ libcurl-devel httpd httpd-devel openssl-devel readline-devel zlib-devel curl-devel mysql-server mysql-devel ImageMagick ImageMagick-devel ipa-pgothic-fonts |
2,EPELリポジトリの登録
1 |
rpm -ivh http://ftp.riken.jp/Linux/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm |
3,開発ツール・インストール
1 |
yum -y groupinstall "Development Tools" |
4,Rubyをインストール
1 2 3 4 5 6 |
git clone https://github.com/sstephenson/rbenv.git ~/.rbenv echo 'export PATH="$HOME/.rbenv/bin:$PATH"'>> ~/.bashrc echo 'eval "$(rbenv init -)"' >> ~/.bashrc source ~/.bashrc mkdir ~/.rbenv/plugins cd ~/.rbenv/plugins |
1 |
git clone git://github.com/sstephenson/ruby-build.git |
10分ほどかかります。
1 |
rbenv install 2.2.5 |
1 |
rbenv shell 2.2.5 |
5,bundlerインストール
1 |
gem install bundler |
6,MySQL redmine用の設定
1 2 3 4 5 6 7 8 9 10 11 12 13 |
service mysqld start mysql -u root update mysql.user set password=password('centos') where user = 'root'; flush privileges; exit; mysql -u root -p Enter password:centos create database db_redmine default character set utf8; grant all on db_redmine.* to user_redmine@localhost identified by 'redmine'; flush privileges; exit; |
7,redmineインストール
1 2 3 |
curl -O http://www.redmine.org/releases/redmine-3.3.0.tar.gz tar zxvf redmine-3.3.0.tar.gz mv redmine-3.3.0 /var/lib/redmine |
8,DB情報設定
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
cd /var/lib/redmine/config cat <<EOF > database.yml production: adapter: mysql2 database: db_redmine host: localhost username: user_redmine password: redmine encoding: utf8 EOF cd /var/lib/redmine bundle install --without development test --path vendor/bundle bundle exec rake generate_secret_token RAILS_ENV=production bundle exec rake db:migrate RAILS_ENV=production REDMINE_LANG=ja bundle exec rake redmine:load_default_data |
9,Passengerインストール
1 2 3 4 5 6 7 |
cd /var/lib/redmine gem install passenger --no-rdoc --no-ri passenger-install-apache2-module passenger-install-apache2-module --snippet > /etc/httpd/conf.d/passenger.conf chown -R apache:apache /var/lib/redmine |
10,httpd設定
1 2 3 4 |
vim /etc/httpd/conf/httpd.conf #DocumentRoot "/var/www/html" ↓↓ DocumentRoot "/var/lib/redmine/public" |
DocumentRootで検索 /DocumentRoot
1 2 3 4 |
chown -R apache:apache /var/lib/redmine chmod o+x /root/ /etc/rc.d/init.d/httpd start |
11,Redmineへアクセス
サーバとトップへアクセス
1 |
http://xxx.xxx.xxx.xxx |
ConoHaでCentOS6.7へRedmine2.5をインストールする
1,パッケージインストール
1 |
yum -y install git gcc gcc-c++ libcurl-devel httpd httpd-devel openssl-devel readline-devel zlib-devel curl-devel mysql-server mysql-devel ImageMagick ImageMagick-devel ipa-pgothic-fonts |
2,EPELリポジトリの登録
1 |
rpm -ivh http://ftp.riken.jp/Linux/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm |
3,開発ツール・インストール
1 |
yum -y groupinstall "Development Tools" |
4,Rubyをインストール
1 2 3 4 5 6 7 8 9 10 11 |
git clone https://github.com/sstephenson/rbenv.git ~/.rbenv echo 'export PATH="$HOME/.rbenv/bin:$PATH"'>> ~/.bashrc echo 'eval "$(rbenv init -)"' >> ~/.bashrc source ~/.bashrc mkdir ~/.rbenv/plugins cd ~/.rbenv/plugins git clone git://github.com/sstephenson/ruby-build.git rbenv install 2.0.0-p648 rbenv shell 2.0.0-p648 |
5,bundlerインストール
1 |
gem install bundler |
6,MySQL redmine用の設定
1 2 3 4 5 6 7 8 9 10 11 12 13 |
service mysqld start mysql -u root update mysql.user set password=password('centos') where user = 'root'; flush privileges; exit; mysql -u root -p Enter password:centos create database db_redmine default character set utf8; grant all on db_redmine.* to user_redmine@localhost identified by 'redmine'; flush privileges; exit; |
7,redmineインストール
1 2 3 |
curl -O http://www.redmine.org/releases/redmine-2.5.0.tar.gz tar zxvf redmine-2.5.0.tar.gz mv redmine-2.5.0 /var/lib/redmine |
8,DB情報設定
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
cd /var/lib/redmine/config cat <<EOF > database.yml production: adapter: mysql2 database: db_redmine host: localhost username: user_redmine password: redmine encoding: utf8 EOF cd /var/lib/redmine bundle install --without development test cd /var/lib/redmine/config bundle exec rake generate_secret_token RAILS_ENV=production bundle exec rake db:migrate |
9,Passengerインストール
1 2 3 4 5 6 7 |
cd /var/lib/redmine gem install passenger --no-rdoc --no-ri passenger-install-apache2-module passenger-install-apache2-module --snippet > /etc/httpd/conf.d/passenger.conf chown -R apache:apache /var/lib/redmine |
10,httpd設定
1 2 3 4 |
vim /etc/httpd/conf/httpd.conf #DocumentRoot "/var/www/html" ↓↓ DocumentRoot "/var/lib/redmine/public" |
DocumentRootで検索 /DocumentRoot
1 2 3 4 |
chown -R apache:apache /var/lib/redmine chmod o+x /root/ /etc/rc.d/init.d/httpd start |
11,Redmineへアクセス
サーバとトップへアクセス
1 |
http://xxx.xxx.xxx.xxx |
注意点(ポイント)
1,redmine-2.5.0の場合、Rubyのバージョンが依存する(2.0.0-p648)
2.2.3だとだめだった
2,chmod o+x /root/ をしないとダメだった
画面表示されない時はログファイルでエラーの内容を確認
find / -name error_log
cat /var/log/httpd/error_log
参考
http://j-orangepekoe.blog.so-net.ne.jp/2016-03-02
http://www.aetherworks.org/article/112066375.html
http://qiita.com/mozo/items/6ec0151dad350c051399
http://blog.redmine.jp/articles/2_5/installation_centos/
http://blog.redmine.jp/articles/3_2/install/centos/