作者存档: zhcj - 第3页

archlinux安装nginx+mariadb+php-fpm

gentoo某次升级之后,残废了,于是转战到arch中,安装了kde5,配置了web开发环境。

arch中安装kde5是相当简单的,一条命令足够了:

pacman -S plasma sddm

好进入正题,arch中安装nginx+mariadb+php-fpm也是相当简单,不过配置起来和别的不太一样,费了点时间。

1、安装基本组件:

pacman -S nginx php-fpm mariadb php-gd

2、配置maridb,安装数据库及设置密码等:

参考:https://wiki.archlinux.org/index.php/MySQL

mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
systemctl start mysqld
mysql_secure_installation
systemctl restart mysqld

3、配置nginx,修改配置文件,主要是改成以下内容

        location / {
            root   /data/web;
            index  index.php index.html index.htm;
        }
......
        location ~ \.php$ {
            fastcgi_pass   unix:/run/php-fpm/php-fpm.sock;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  /data/web$fastcgi_script_name;
            include        fastcgi_params;
        }

按照红色字体修改即可。

4、启动及开机启动

systemctl start nginx
systemctl start php-fpm
systemctl enable nginx
systemctl enable mysqld
systemctl enable php-fpm

写个phpinfo测试一下就行了。

Gentoo中安装kvm(qemu)

kvm是Kernel-based Virtual Machine的简称,是一个开源的、基于硬件的完全虚拟化技术,需要硬件支持。

官方网站:http://www.linux-kvm.org/

qemu是一个通用的、开源的模拟器。一般所说的kvm,即指这两者的组合。

官方网站:http://wiki.qemu.org/

去年在Gentoo中安装过一次,感觉用kvm来虚拟桌面环境,效率不高,当然,用来虚拟不带桌面的服务器系统是相当强悍的。

这次是gentoo中文社区一好友极力鼓动我安装的,说现在kvm虚拟windows桌面环境相当不错,性能很好,另外,还有redhat支持的virt-manager图形界面管理工具,功能也足够强大了。

不过他是在fedora22中安装的,安装非常简单。于是,我也就在fedora中安装了一下,感觉确实不错。于是尝试在Gentoo中安装,现在学习东西感觉有些费劲,中间遇到若干问题,有些解决起来费了一番功夫。

安装参考:https://wiki.gentoo.org/wiki/QEMU

1、配置内核,按照上面wiki中要求去配置就行,这里就不再一一说明。但需要注意的是,开启nat转发还要配置相应参数,上述教程中没有说明。具体情况可加本人qq交流,因为光内核配置就折腾了一晚上,实在记不清楚了。

2、需要配置的use(我是kde5桌面~amd64版,全局use有-iptables -ipv6,以下包及use仅供参考):

net-misc/spice-gtk gtk3 python usbredir
net-libs/gtk-vnc python
app-emulation/libvirt-glib python
app-emulation/libvirt virt-network
net-firewall/iptables ipv6
net-dns/dnsmasq script
app-emulation/qemu spice usbredir bluetooth
x11-drivers/xf86-video-qxl xspice

3、安装软件

emerge -av virt-manager xf86-video-qxl

配置开机启动(systemd):

systemctl enable libvirtd

添加用户到qemu及kvm组:

gpasswd -a linuxuser qemu;gpasswd -a linuxuser kvm

4、创建虚拟机及主机上配置

建议使用集成了virtio驱动的iso文件来安装,不过,其他iso也可以,但安装过程缓慢。

新建虚拟机要想要更好的性能:

虚拟硬盘和网卡选择virtio模式;

显卡选择spice协议;

声卡选择ac97,默认的型号找不到驱动;

添加硬件->Input->EvTouch USB图形表格,来实现鼠标在主机和虚拟机之间切换(不然虚拟机捕获鼠标后,需要按Ctrl+Alt+L来返回主机)。

5、虚拟机安装硬件驱动:

在这里下载驱动:https://fedoraproject.org/wiki/Windows_Virtio_Drivers#Direct_download

比如windows虚拟机,选择里面的Stable virtio-win iso,下载之后,挂载到虚拟机光驱上,就可以安装了。怎么装?别告诉我你不会安装!

另外,想要支持共享剪贴板,需要在虚拟机中安装软件:

下载地址:http://www.spice-space.org/download.html

如:Windows guest tools,虚拟机下载http://www.spice-space.org/download/windows/spice-guest-tools/spice-guest-tools-0.100.exe,安装即可。

6、其他

kvm的网络配置稍显复杂,默认用nat转发即可上网。至于桥接,比较复杂,有时间再去研究吧。

virt-manager启动必须是root权限,因此每次运行都需要输入密码。

kvm可以直接使用virtualbox创建的虚拟机,而且再用virtualbox打开没任何问题。

 

用了几天了,感觉kvm和virtualbox相比,各有优劣。kvm的优势是硬盘采用virtio模式,性能要好,不仅仅在服务器系统方面,而且现在的桌面性能也不错了。从日常使用来说,kvm最大的问题一个是分辨率是固定的,不能随虚拟机窗口大小调整,二是与主机共享文件不方便,多数是建议主机安装samba来共享。

Gentoo安装kde5

​kde5出来已经很长一段时间了,虽然没有达到完全可用的程度,但从目前个人使用来看,日常使用也基本差不多了。下面把个人安装使用的一些方法做一说明,仅供参考。

参考:https://wiki.gentoo.org/wiki/KDE/Overlay

1、添加kde的overlay:

layman -a kde
echo -e "-qt5" >> /etc/portage/profile/use.stable.mask

或者在/etc/portage/make.conf的USE中添加qt5。

2、解除kde5的mask

方法一:按官方wiki中的方法做软链接:

cd /etc/portage/package.accept_keywords
ln -s /var/lib/layman/kde/Documentation/package.accept_keywords/kde-frameworks-5.9.keywords
ln -s /var/lib/layman/kde/Documentation/package.accept_keywords/kde-plasma-5.2.keywords

方法二:来个简单粗暴的方式(不建议):

rm /var/lib/layman/kde/profiles/package.mask/frameworks*
rm /var/lib/layman/kde/profiles/package.mask/plasma*

方法三:将mask掉的包加到/etc/portage/package.unmask中(注:根据实际情况自行修改参数):

cat /var/lib/layman/kde/profiles/package.mask/plasma-5.3.0 >> /etc/portage/package.unmask
cat /var/lib/layman/kde/profiles/package.mask/kde-apps-15.04.0 >> /etc/portage/package.unmask
sed -i "s/\~//g;s/-15.04.0//g;s/-5.9.0//g;s/-5.3.0//g" /etc/portage/package.unmask

我用的是方法三。
3、安装frameworks和plasma

emerge @kde-frameworks @kde-plasma

这一步最麻烦,会遇到多个包block或者collisions,采用简单粗暴的方法即可,遇到哪个包有问题就干掉它。
还有一个问题是,gentoo开发者会在kde官方发布之前,提前把kde5的ebuild写出来,比如现在的plasma-5.3.0,这个得需要自己看具体情况去处理了。

4、kde5组件的安装

现在kde5下的应用移植还不完全,有些软件连测试版都没有,只好兼容kde4下的,比如以kde-apps-14.12.3这种形式的包出现。目前我使用的测试版本软件有(cat /etc/portage/package.keywords):

=kde-apps/dolphin-9999 **
=kde-apps/libkonq-5.9999 **
=kde-apps/kcalc-9999 **
=kde-apps/ksnapshot-5.9999 **
=kde-apps/okular-5.9999 **
=kde-apps/libkexiv2-5.9999 **
=kde-apps/kmix-5.9999 **
=kde-apps/ark-5.9999 **

其中kde-apps/libkonq包是dolphin添加右键菜单支持的包。
将包添加到package.keywords后,安装方式如下:

emerge -av =kde-apps/ark-5.9999

5、系统托盘图标问题

qt4程序在kde5下没有系统托盘,需要安装sni-qt这个包,比如qBittorrent等软件。

gtk程序及wineQQ需要安装wmsystemtray(需要自己安装font-misc-misc这个字体包)这个包来实现托盘,但无法放到系统托盘。

6、kde5不能用kdm来引导桌面环境,安装sddm,取代kdm。

emerge -av sddm

7、设置qt5为默认qt编译器

cd /etc/xdg/qtchooser/
rm default.conf
ln -s qt5.conf default.conf

8、输入法,fcitx需要安装gentoo-zh的overlay中的fcitx-qt5这个包:

emerge fcitx-qt5

目前还在继续折腾中。。。

Gentoo的portage已支持直接更新第三方源(overlay)

多数发行版都会自动更新所有添加的源,包括第三方源,如redhat系、debian系、arch linux等,而Gentoo添加了第三方源(overlay)之后,更新时,需要用layman -S命令来单独更新全部overlay。

现在,最新的portage管理器也终于支持用emerge命令来更新overlay了!

2015-02-04-portage-sync-changes
  Title                     New portage plug-in sync system
  Author                    Brian Dolbec <dolsen@gentoo.org>
  Posted                    2015-02-02
  Revision                  1

There is a new plug-in sync system in >=sys-apps/portage-2.2.16.
This system will allow third party modules to be easily installed.  Look
for a new layman plug-in sync module in layman's next release.  Next is
a brief look at the changes.  See the url [1] listed below for detailed
descriptions and usage.

Changes:  /etc/portage/repos.conf/*
    New setting for all repository types (needed):
        auto-sync = yes/no, true/false  # default if absent: yes/true

    New for git sync-type: (applies to clone only)
        sync-depth = n  where n = {0,1,2,3,...} (optional, default = 1)
            0 -- full history
            1 -- shallow clone, only current state (default)
            2,3,... number of history changes to download

    New sync-type modules:
        sync-type = svn  # sync a subversion repository
        sync-type = websync # Perform an emerge-webrsync operation
        sync-type = laymanator  # (if installed) runs a layman -s action

    New native portage postsync hooks
        /etc/portage/postsync.d/*
            Runs hooks once, only after all repos have been synced.
        /etc/portage/repo.postsync.d/*
            Runs each script with three arguments:
                repo name, sync-uri, location
            Each script is run at the completion of every repo synced.

Migration:
    Edit /etc/portage/repos.conf/*.conf files, add the auto-sync option
    to each repository definition.  Edit sync-type option to one of the
    supported types {rsync, git, cvs, svn, websync, laymanator}.
        [some-repo]
        ...
        sync-type = rsync
        auto-sync = yes

    For an existing /etc/portage/repos.conf/layman.conf file:
        1) change/add the sync-type
            sync-type = laymanator
        2) Ensure you have the correct layman version installed with
           it's laymanator module also installed.
    Alternate method:
        Please see the wiki page url [1] for detailed instructions.

Primary control of all sync operations has been moved from emerge to
emaint.  "emerge --sync" now just calls the emaint sync module with the
--auto option.  The --auto option performs a sync on only those
repositories with the auto-sync setting not set to 'no' or 'false'. If
it is absent, then it will default to yes and "emerge --sync" will sync
the repository.

NOTE: As a result of the default auto-sync = True/Yes setting, commands
    like "eix-sync", "esync -l", "emerge --sync && layman -S" will cause
    many repositories to be synced multiple times in a row.  Please edit
    your configs or scripts to adjust for the new operation.

WARNING:
    Due to the above default. For any repos that you EXPLICITLY do not
    want to be synced. You MUST set "auto-sync = no"

The 'emaint sync' module operates similar to layman.  It can sync
single or multiple repos.  See "emaint --help" or for more details and
examples see the wiki page listed below [1].

Additional help and project API documentation can be found at:

[1] https://wiki.gentoo.org/wiki/Project:Portage/Sync

也就是从sys-apps/portage-2.2.16开始,添加了配置文件之后,用emerge –sync就可以直接更新overlay了。另外,layman也增加了一个use,sync-plugin-portage(Install the sys-apps/portage sync module),默认不开启。如果需要手动配置,可以采用以下方法:

1、首先,需要创建一个配置文件。安装portage和layman时没有自动创建文件和目录,只好手动创建了。

mkdir /etc/portage/repos.conf
touch /etc/portage/repos.conf/layman.conf

2、手动添加配置信息,例如gentoo-zh:

[gentoo-zh]
location = /var/lib/layman/gentoo-zh
auto-sync = yes
sync-type = git
sync-uri = https://github.com/microcai/gentoo-zh.git

注:有了配置文件之后,新安装的overlay也会自动添加配置文件,但需要修改,否则更新时出错。这是默认添加的配置:

[kde]
priority = 50
location = /var/lib/layman/kde
auto-sync = No
layman-type = git

有三个地方需要修改:auto-sync的No修改为yes;layman-type改为sync-type;按前面配置方式添加sync-uri项。改成下面内容:

[kde]
priority = 50
location = /var/lib/layman/kde
auto-sync = yes
sync-type = git
sync-uri = https://github.com/gentoo/kde.git

配置完成。

以后,再用emerge –sync更新portage时,官方portage更新完成之后,会自动更新overlay,出现如下信息:

>>> Syncing repository 'gentoo-zh' into '/var/lib/layman/gentoo-zh'...
/usr/bin/git pull
remote: Counting objects: 15, done.
remote: Compressing objects: 100% (15/15), done.
remote: Total 15 (delta 4), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (15/15), done.
From git://github.com/microcai/gentoo-zh
   da7bbf3..a4d1c13  master     -> origin/master
Updating da7bbf3..a4d1c13
Fast-forward
 media-video/bilibili-player/Manifest                                                     | 2 +-
 media-video/bilibili-player/{bilibili-player-0.10.ebuild => bilibili-player-0.12.ebuild} | 8 ++++++--
 2 files changed, 7 insertions(+), 3 deletions(-)
 rename media-video/bilibili-player/{bilibili-player-0.10.ebuild => bilibili-player-0.12.ebuild} (88%)
=== Sync completed for gentoo-zh
>>> Syncing repository 'kde' into '/var/lib/layman/kde'...
/usr/bin/git pull
Already up-to-date.
=== Sync completed for kde

Gentoo中安装配置Oracle JDK

在Gentoo中如果直接emerge jdk,会安装virtual/jdk这个包,默认依赖开源的dev-java/icedtea-bin;

如果直接emerge oracle-jdk-bin,则直接安装高版本的oracle-jdk-bin-1.8,同时也会安装icedtea-bin。

想直接用oracle-jdk-bin-1.7的话,不想安装icedtea-bin,并且不用mask掉高版本的oracle-jdk,可以这样来安装:

1、查找1.7的oracle-jdk具体版本

ls /usr/portage/dev-java/oracle-jdk-bin/

结果如下:

ChangeLog  files         oracle-jdk-bin-1.7.0.60.ebuild  oracle-jdk-bin-1.7.0.72.ebuild
Manifest   metadata.xml  oracle-jdk-bin-1.7.0.71.ebuild  oracle-jdk-bin-1.8.0.25.ebuild

确定1.7的版本号为oracle-jdk-bin-1.7.0.72。

2、安装此版本的oracle-jdk

emerge -av =oracle-jdk-bin-1.7.0.72

出现如下提示:

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild   RF   ] dev-java/oracle-jdk-bin-1.7.0.72:1.7  USE="X alsa fontconfig (-aqua) -derby -doc -examples -jce -nsplugin -pax_kernel (-selinux) -source" 138,893 KiB

Total: 1 package (1 reinstall), Size of downloads: 138,893 KiB
Fetch Restriction: 1 package (1 unsatisfied)

Fetch instructions for dev-java/oracle-jdk-bin-1.7.0.72:
 * 
 * Oracle requires you to download the needed files manually after
 * accepting their license through a javascript capable web browser.
 * 
 * Download the following files:
 *   jdk-7u72-linux-x64.tar.gz
 * at 'http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html'
 * and move them to '/usr/portage/distfiles'
 * 
 * If the above mentioned urls do not point to the correct version anymore,
 * please download the files from Oracle's java download archive:
 * 
 *    http://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase7-521261.html#jdk-7u72-oth-JPR
 * 

Would you like to merge these packages? [Yes/No]

说明需要去oracle官网去下载“jdk-7u72-linux-x64.tar.gz”,去下面提示的“http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html”下载。前提是你要有oracle的帐号,登录之后,同意下载协议后就可以下载。下载之后,将文件复制到/usr/portage/distfiles/目录才可以安装。

3、最后再安装virtual/jdk

emerge -av jdk

你会发现不再安装icedtea-bin这个包了。

4、配置jdk

eselect java-vm list

出现:

Available Java Virtual Machines:
[1]   icedtea-bin-1.7  system-vm //注:好像是这样,记不清了,因为设置之后就没这个选项了

[2]   oracle-jdk-bin-1.7

然后运行:

eselect java-vm set system 2

设置完成,查看一下:

eselect java-vm list

出现如下提示,说明设置正确了。

Available Java Virtual Machines:
[1]   oracle-jdk-bin-1.7  system-vm

 

5、设置JAVA_HOME、JDK_HOME

vi /etc/profile

将下面两行添加到文件末尾:

JAVA_HOME=/opt/oracle-jdk-bin-1.7.0.72
JDK_HOME=/opt/oracle-jdk-bin-1.7.0.72/bin

至此,整个安装配置过程完成。

centos中yum安装ntfs3g

CentOS默认源里没有ntfs3g,想要添加ntfs支持,无非是自己下载编译安装或者加源yum安装。

昨天重新安装了一个CentOS7,用的是添加aliyun的epel源来yum安装的方式,简单易行。

1、加源

wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

2、安装

yum update;yum install ntfs3g

来源:http://mirrors.aliyun.com/help/epel,说明里面没有写CentOS7的源,实际上是有的,把里面的5/6改成7就行了。

把博客的评论关闭,清静多了

这段时间大量的垃圾评论,烦死了,索性直接把博客的评论关掉,世界一下子清静了。。。

Debian sid安装及配置

一直没在笔记本上硬盘安装过Debian,最近Debian7.7发布了,昨天试着装了一个sid(桌面环境,就用最新版本的,强迫症),感觉挺不错的一个发行版。

1、下载:http://mirrors.aliyun.com/debian-cd/7.7.0/amd64/iso-cd/

我下载的是netinstall,安装时太痛苦了,幸亏网速还可以。建议下载cd或者dvd来安装。

2、安装,选择gnome桌面环境即可。

3、改源,更新成sid。

deb http://mirrors.163.com/debian/ jessie main
deb-src http://mirrors.163.com/debian/ jessie main

改成

deb http://mirrors.aliyun.com/debian/ sid main contrib non-free
deb-src http://mirrors.aliyun.com/debian/ sid main contrib non-free

4、更新并清理

sudo apt-get update;sudo apt-get dist-upgrade;sudo apt-get clean;sudo apt-get autoclean;sudo apt-get autoremove

Debian sid安装完成,下面是其他配置:

1、安装flash插件:

sudo apt-get install flashplugin-nonfree

2、配置无线网卡

sudo apt-cache search rtl8723befw.bin

出现:

firmware-realtek - Binary firmware for Realtek wired and wireless network adapters

安装固件:

sudo apt-get install firmware-realtek

3、配置fcitx输入法

sudo im-config

Gentoo安装的软件列表

cat /var/lib/portage/world
app-arch/p7zip
app-arch/rar
app-arch/unrar
app-editors/vim
app-emulation/docker
app-emulation/virtualbox-bin
app-emulation/wine
app-i18n/kcm-fcitx
app-office/wps-office
app-portage/gentoolkit
app-portage/layman
app-text/goldendict
app-text/groff-utf8
dev-db/mariadb
dev-lang/php
dev-util/android-tools
kde-base/ark
kde-base/gwenview
kde-base/kcalc
kde-base/kdebase-meta
kde-base/kdegames-meta
kde-base/kdeplasma-addons
kde-base/kgeography
kde-base/kmix
kde-base/krdc
kde-base/ksnapshot
kde-base/ktouch
kde-base/okular
kde-misc/networkmanagement
media-fonts/dejavu
media-fonts/source-han-sans
media-fonts/wqy-microhei
media-gfx/gimp
media-sound/audacity
media-video/kamerka
media-video/kdenlive
media-video/qt-recordmydesktop
media-video/smplayer
net-analyzer/macchanger
net-analyzer/nmap
net-fs/samba
net-ftp/filezilla
net-im/skype
net-irc/hexchat
net-misc/WeCase
net-misc/aria2
net-misc/iptux
net-p2p/qbittorrent
net-proxy/goagent
net-wireless/aircrack-ng
sci-geosciences/googleearth
sys-block/partitionmanager
sys-boot/grub
sys-boot/os-prober
sys-fs/ntfs3g
sys-kernel/gentoo-sources
sys-kernel/linux-firmware
virtual/jdk
www-client/firefox
www-client/google-chrome-unstable
www-client/opera
www-plugins/adobe-flash
www-plugins/aliedit
www-servers/nginx
x11-base/xorg-server
x11-drivers/xf86-input-synaptics
x11-themes/gtk-engines-qtpixmap
x11-themes/kfaenza
x11-themes/oxygen-gtk

ALSA lib pcm_dmix.c:1022:(snd_pcm_dmix_open) unable to open slave

centos7中某次升级后,发现许多软件无法播放声音了。为解决问题,在终端打开firefox,播放网页中声音时,出现提示:

ALSA lib pcm_dmix.c:1022:(snd_pcm_dmix_open) unable to open slave

感觉是pulseaudio的问题,重新安装pulseaudio,问题依旧。用rpm -qa | grep alsa检查,发现只有这三个包:

alsa-lib-1.0.27.2-3.el7.x86_64
alsa-tools-firmware-1.0.27-4.el7.x86_64
alsa-firmware-1.0.27-2.el7.noarch

没有pulseaudio相关包,于是:

yum install alsa-plugins-pulseaudio

问题解决!

第 3 页,共 49 页12345...102030...最旧 »