Linux 系统通过openssl命令生成https证书

首先执行如下命令生成一个key
openssl genrsa -des3 -out ssl.key 2048
然后他会要求你输入这个key文件的密码。不推荐输入。因为以后要给nginx使用。每次reload nginx配置时候都要你验证这个PAM密码的。
由于生成时候必须输入密码。你可以输入后再删掉。
mv ssl.key xxx.key
openssl rsa -in xxx.key -out ssl.key
rm xxx.key

然后根据这个key文件生成证书请求文件
openssl req -new -key ssl.key -out ssl.csr
以上命令生成时候要填很多东西

最后根据这2个文件生成crt证书文件
openssl x509 -req -days 365 -in ssl.csr -signkey ssl.key -out ssl.crt
这里365是证书有效期

如果需要用pfx 可以用以下命令生成
openssl pkcs12 -export -inkey ssl.key -in ssl.crt -out ssl.pfx

在需要使用证书的nginx配置文件的server节点里加入以下配置:
ssl on;
ssl_certificate /home/ssl.crt;
ssl_certificate_key /home/ssl.key;
ssl_session_timeout 5m;
ssl_protocols SSLv2 SSLv3 TLSv1;
ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
ssl_prefer_server_ciphers on;
然后重启nginx

http强制跳转到https
server{
    listen 80;
    server_name example.com www.example.com;
    return 301 https://www.example.com$request_uri;
}

Fedora 20 安装 NVIDIA 官方驱动(单显卡)

注意:本文仅适用于单显卡机器,双显卡笔记本请绕行

lspci |grep -i VGA
如果是 nvidia 的显卡就是输出以下类似信息:
01:00.0 VGA compatible controller: NVIDIA Corporation GT218 [GeForce 210] (rev a2)

添加 RPMFusion 的开源与闭源软件仓库(已经添加的可以略过此步):
sudo rpm -Uvh http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm
sudo rpm -Uvh http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm

akmod 是避免内核升级时产生问题的一个简单易行的好选择:
sudo yum install akmod-nvidia xorg-x11-drv-nvidia-libs

yum list installed |grep nvidia
输出的结果类似于:
akmod-nvidia.x86_64              1:331.89-2.fc20    @rpmfusion-nonfree-updates

从 kernel initramfs 中移除/禁止 nouveau 驱动
sudo mv /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r)-nouveau.imgdracut
sudo dracut /boot/initramfs-$(uname -r).img $(uname -r)

sudo reboot

Fedora 20/openSUSE 13.1 安装 QQ国际版1.6

wget http://packages.linuxdeepin.com/deepin/pool/non-free/d/deepinwine-qqintl/wine-qqintl_0.1.3-2_i386.deb
解压缩,给予777权限,将 wine-qqintl_0.1.3-2_i386/usr/ 拷贝到 /usr/ 目录下

安装需要用到的库:

Fedora:
sudo yum install libstdc++.so.6 gtk2.i686 cups-libs.i686
sudo yum install glibc.i686 libpng12.i686 libXext.i686
sudo yum install alsa-plugins-pulseaudio.i686 gtk+-devel.i686 lcms2-devel.i686 libSM.i686 ncurses-*

OpenSUSE:
sudo zypper install libstdc++.so.6 gtk2-32bit cups-libs-32bit
sudo zypper install glibc-32bit libpng12-0-32bit
sudo zypper install alsa* ncurses-*

执行:/usr/share/deepinwine/qqintl/wine/bin/wine 和 /usr/bin/wine-qqintl 查看并安装缺失的 lib

如果菜单栏里的图标不显示,则:
vi /usr/share/applications/qqintl.desktop
Icon=/usr/share/icons/hicolor/64x64/apps/qqintl.png

Ubuntu 14.04 安装 Mono

sudo apt-get install mono-gmcs mono-devel
mono -V

sudo service apache2 stop
sudo apt-get install libapache2-mod-mono libmono-i18n2.0-cil

# For .NET 2.0
sudo apt-get install mono-apache-server2
# For .NET 4.0
sudo apt-get install mono-apache-server4

sudo a2enmod mod_mono
sudo service apache2 restart

hostname
hostname -f

http://go-mono.com/config-mod-mono/Default.aspx
sudo vi /etc/apache2/sites-enabled/000-default.conf
<VirtualHost *:80>
  ServerName localserver127.com
  ServerAdmin web-admin@li-ubuntu
  DocumentRoot /home/li/WebDoc/
  # MonoServerPath can be changed to specify which version of ASP.NET is hosted
  # mod-mono-server1 = ASP.NET 1.1 / mod-mono-server2 = ASP.NET 2.0
  # For SUSE Linux Enterprise Mono Extension, uncomment the line below:
  # MonoServerPath li-ubuntu "/opt/novell/mono/bin/mod-mono-server2"
  # For Mono on openSUSE, uncomment the line below instead:
  MonoServerPath li-ubuntu "/usr/bin/mod-mono-server2"

  # To obtain line numbers in stack traces you need to do two things: 
  # 1) Enable Debug code generation in your page by using the Debug="true" 
  #    page directive, or by setting <compilation debug="true" /> in the 
  #    application's Web.config
  # 2) Uncomment the MonoDebug true directive below to enable mod_mono debugging
  MonoDebug li-ubuntu true
  
  # The MONO_IOMAP environment variable can be configured to provide platform abstraction
  # for file access in Linux.  Valid values for MONO_IOMAP are:
  #    case
  #    drive
  #    all
  # Uncomment the line below to alter file access behavior for the configured application
  MonoSetEnv li-ubuntu MONO_IOMAP=all
  #
  # Additional environtment variables can be set for this server instance using 
  # the MonoSetEnv directive.  MonoSetEnv takes a string of 'name=value' pairs 
  # separated by semicolons.  For instance, to enable platform abstraction *and* 
  # use Mono's old regular expression interpreter (which is slower, but has a
  # shorter setup time), uncomment the line below instead:
  # MonoSetEnv li-ubuntu MONO_IOMAP=all;MONO_OLD_RX=1

  MonoApplications li-ubuntu "/:/home/li/WebDoc/"
  <Location "/">
    Allow from all
    Order allow,deny
    MonoSetServerAlias li-ubuntu
    SetHandler mono
    SetOutputFilter DEFLATE
    SetEnvIfNoCase Request_URI ".(?:gif|jpe?g|png)$" no-gzip dont-vary
  </Location>
  <IfModule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/html text/plain text/xml text/javascript
  </IfModule>
</VirtualHost>

vi /home/li/WebDoc/index.aspx
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
  <head>
    <title>ASP Test Page</title>
  </head>
  <body>
        <form id="form1" runat="server">
          <asp:label id="lbl1" runat="server">ASP Test Page</asp:label>
        </form>
  </body>
</html>

Fedora 22/20 GNOME 字体与界面美化

添加RPMFusion源:
20/21:
sudo yum localinstall --nogpgcheck http://mirrors.aliyun.com/rpmfusion/free/fedora/rpmfusion-free-release-stable.noarch.rpm
sudo yum localinstall --nogpgcheck http://mirrors.aliyun.com/rpmfusion/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm
22:
sudo rpm -Uhv http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-22.noarch.rpm
sudo rpm -Uhv http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-22.noarch.rpm

安装字体渲染程序:
sudo rpm -Uvh http://www.infinality.net/fedora/linux/infinality-repo-1.0-1.noarch.rpm
sudo yum install freetype-infinality fontconfig-infinality
注销重登陆

安装字体:
sudo yum install wqy-microhei-fonts.noarch

比较清晰美观的字体设置方案:
窗口标题字体:Liberation Sans 10
默认字体:Liberation Sans 10
文档字体:Liberation Sans 9
等宽字体:Liberation Mono 9
微调:Medium
反锯齿:Grayscale
文本比例因子:1.0

显示桌面图标:
sudo yum install gnome-tweak-tool
gnome-tweak-tool
选择“桌面”,Icons on Desktop设置为“开启”。
显示窗口最大化、最小化按钮:
选择“窗口”,Maximize、Minimize设置为“开启”。
任务栏显示日期:
选择 Top Bar,勾选 Show date

sudo yum install docky
Docky -> Docks -> 主题:Transparent
图标大小 32


在Docky中添加Chrome图标:
sudo yum install gconf-editor
gconf-editor
退出Docky
/apps/docky-2/Docky/Interface/DockPreferences/Dockn
在Launchers添加:
file:///usr/share/applications/google-chrome.desktop

Fedora 下通过默认图标启动 Chrome 每次都会创建新窗口,所以不再推荐上面的方法,可以将 /usr/share/applications/google-chrome.desktop 拷贝到桌面一份,每次通过桌面图标启动

任务栏透明:
sudo vi /usr/share/gnome-shell/theme/gnome-shell.css
修改:
#panel {
    background-color: rgba(0,0,0,0.3); /*black;*/


减小标题栏高度:
sudo vi /usr/share/themes/Adwaita/metacity-1/metacity-theme-3.xml
搜索 title_vertical_pad
将第一项的 value="16" 改为 13 或 其他数字



安装 Fedora 其他主题:
sudo yum install gnome-shell-extension-user-theme
sudo yum install gnome-shell-theme-zukitwo
gnome-tweak-tool -> Extensions -> 开启 User themes
重启 gnome-tweak-tool -> Appearance -> Shell主题 -> zukitwo(该主题具有透明效果)



安装 Numix Icon Theme:
先安装 Fedy:
su -c "curl https://satya164.github.io/fedy/fedy-installer -o fedy-installer && chmod +x fedy-installer && ./fedy-installer"
上面的代码来自 Fedy 官方主页
安装 Numix 主题:
sudo fedy -e numix_themes



安装 Faenza 图标集:
yum install kfaenza-icon-theme
设置 gnome-tweak-tool --> Appearance --> Icons --> KFaenza


显示注销按钮:
普通用户权限下执行:
gsettings set org.gnome.shell always-show-log-out true

文件管理器优化:
首选项 -> 视图 -> 查看新文件夹使用:列表视图 、 勾选“将文件夹放在文件前” 、 勾选“显示隐藏和备份文件” 、 列表默认缩放级别:33%
行为 -> 可执行文本文件 -> 每次都询问
显示 -> 勾选“以树的方式进行文件夹导航”

gedit 优化:
查看 -> 取消勾选“工具栏”
首选项 -> 查看 -> 显示行号
首选项 -> 编辑器 -> 制表符宽度4 、 勾选“使用空格代替制表符插入” 、 取消勾选“在保存前创建备份文件”

CentOS 7.0 添加 SWAP

1.进入目录
cd /var/
2.获取要增加的SWAP文件块(这里以1GB为例)
dd if=/dev/zero of=swapfile bs=1024 count=1038336
3.创建SWAP文件
/sbin/mkswap swapfile
4.激活SWAP文件
/sbin/swapon swapfile
5.查看SWAP信息是否正确
/sbin/swapon -s
6.添加到fstab文件中让系统引导时自动启动
echo "/var/swapfile swap swap defaults 0 0" >>/etc/fstab