月度归档:2017年09月

linux下安装usb无线网卡驱动

查看显卡型号

lsusb 

可以看到显卡型号为RTL8188EUS。通过搜索查找到https://github.com/lwfinger/rtl8188eu这个驱动。

安装驱动

wget https://github.com/lwfinger/rtl8188eu/archive/master.zip
unzip master.zip
cd rtl8188eu-master
make all
sudo make install

自动编译

sudo dkms add ./rtl8188eu
sudo dkms build 8188eu/1.0
sudo dkms install 8188eu/1.0

fedora 26快速安装PHP开发环境

Nvidia显卡驱动

sudo dnf config-manager --add-repo=http://negativo17.org/repos/fedora-nvidia.repo  
sudo dnf install kernel-devel dkms-nvidia -y

Vim & git & hg & svn

sudo dnf install vim git hg subversion -y

sudo不需要密码

sudo visudo

%wheel  ALL=(ALL)       NOPASSWD: ALL

禁止selinux

sudo setenforce 0 

sudo vi /etc/selinux/config

SELINUX=disabled

右键打开控制台窗口

sudo dnf install nautilus-open-terminal -y

Development tools

sudo dnf groupinstall "Development tools" -y

nginx & php & mysql

sudo dnf install  nginx php-cli php-devel php-mbstring php-opcache php-mysqlnd php-intl php-mcrypt php-pdo php-xml php-pecl-memcache  php-pecl-redis php-pecl-sphinx php-pecl-zip php-pgsql php-xdebug php-gd  php-pecl-redis  php-pecl-imagick  php-fpm -y
sudo dnf install mariadb mariadb-server -y
sudo systemctl enable php-fpm nginx mariadb

修改nginx配置

sudo service nginx stop 
sudo vim /etc/nginx/nginx.conf

nginx.conf配置修改如下:

user ning;
error_log /data/log/nginx/error.log;
pid /data/run/nginx.pid;

access_log  /data/log/nginx/access.log  main;

include /data/phpcode/projectname/vagrant/nginx/app.conf;

测试nginx配置

sudo nginx -t

修改nginx service配置:

sudo vim /usr/lib/systemd/system/nginx.service

nginx.service修改内容如下:

[Service]
PIDFile=/data/run/nginx.pid
ExecStartPre=/usr/bin/rm -f /data/run/nginx.pid

重新加载service

sudo systemctl daemon-reload
sudo systemctl start nginx

修改PHP配置

sudo service php-fpm stop
sudo vim /etc/php-fpm.d/www.conf

配置内容

user = ning
group = ning
listen = 127.0.0.1:9000
listen.acl_users = ning
php_value[session.save_path]    = /log/php/session
php_value[soap.wsdl_cache_dir]  = /log/php/wsdlcache
;php_value[opcache.file_cache]  = /log/php/opcache

重启

sudo service php-fpm stop

配置composer

下载安装文件

php -r "copy('https://install.phpcomposer.com/installer', 'composer-setup.php');"

安装

php composer-setup.php

删除安装文件

php -r "unlink('composer-setup.php');"

设置全局路径(windows请按参考文档设置)

sudo mv composer.phar ~/bin/composer

配置使用国内镜像

composer config -g repo.packagist composer https://packagist.phpcomposer.com

How to convert lantern debian/ubuntu deb package to CentOS/fedora rpm/yum package

Install deb to rpm tool

sudo dnf install alien

Download ubuntu deb file

Download url :https://github.com/getlantern/lantern/releases/tag/latest

Convert deb to rpm

sudo alien -r lantern-installer-64-bit.deb

Install rpm

sudo dnf install lantern-4.0.1-2.x86_64.rpm

Get Error:“conflicts with file from package filesystem”

Rebuild RPM

sudo dnf install rpmrebuild
sudo rpmrebuild -pe lantern-4.0.1-2.x86_64.rpm

Comment lines in rebuild file

(Converted from a deb package by alien version 8.95.)
%files
#%dir %attr(0755, root, root) "/"
#%dir %attr(0755, root, root) "/usr"
#%dir %attr(0755, root, root) "/usr/bin"
%attr(0777, root, root) "/usr/bin/lantern"
#%dir %attr(0755, root, root) "/usr/lib"
%dir %attr(0755, root, root) "/usr/lib/lantern"
%attr(0644, root, root) "/usr/lib/lantern/.packaged-lantern.yaml"
%attr(0644, root, root) "/usr/lib/lantern/lantern-binary"
%attr(0755, root, root) "/usr/lib/lantern/lantern.sh"
%attr(0644, root, root) "/usr/lib/lantern/lantern.yaml"
#%dir %attr(0755, root, root) "/usr/share"
#%dir %attr(0755, root, root) "/usr/share/applications"
%attr(0644, root, root) "/usr/share/applications/lantern.desktop"
#%dir %attr(0755, root, root) "/usr/share/doc"
%dir %attr(0755, root, root) "/usr/share/doc/lantern"
%doc %attr(0644, root, root) "/usr/share/doc/lantern/changelog.gz"
%doc %attr(0644, root, root) "/usr/share/doc/lantern/copyright"
#%dir %attr(0755, root, root) "/usr/share/icons"
#%dir %attr(0755, root, root) "/usr/share/icons/hicolor"
#%dir %attr(0755, root, root) "/usr/share/icons/hicolor/128x128"
#%dir %attr(0755, root, root) "/usr/share/icons/hicolor/128x128/apps"
%attr(0644, root, root) "/usr/share/icons/hicolor/128x128/apps/lantern.png"
%changelog

Install again

sudo rpm -i /root/rpmbuild/RPMS/x86_64/lantern-4.0.1-2.x86_64.rpm

Install libappindicator

sudo dnf install libappindicator-gtk3

Refs

alien:deb(ubuntu/debian)与rpm(centos/fedora)转换工具

deb 与 rpm 是GNU/Linux 流行的软件包格式。我们“alien”可以在rpm\dpkg\slackware tgz\deb\slp 格式见进行转换。

Debian/Ubuntu 可使用下面命令安装alien:

sudo apt-get install alien

从RPM转到DEB

举例:假设在目录/tmp 有myprogram.rpm 文件,使用下面命令转换:

sudo alien /tmp/myprogram-1.10-2.i386.rpm

myprogram-1.10-3.i386.deb generated

这时,在/tmp 目录下就会发现有 myprogram.deb ,这时就可以使用dpkg安装:

dpkg -i /tmp/miprogramma.deb

从DEB转到RPM

直接添加参数-r进行转换即可:

sudo alien -r pytube_0.0.8.1-1_all.deb

pytube-0.0.8.1-2.noarch.rpm generated

使用帮助

输入alien可以查看帮助

Usage: alien [options] file [...]
  file [...]                Package file or files to convert.
  -d, --to-deb              Generate a Debian deb package (default).
     Enables these options:
       --patch=<patch>      Specify patch file to use instead of automatically
                            looking for patch in /var/lib/alien.
       --nopatch        Do not use patches.
       --anypatch           Use even old version os patches.
       -s, --single         Like --generate, but do not create .orig
                            directory.
       --fixperms           Munge/fix permissions and owners.
       --test               Test generated packages with lintian.
  -r, --to-rpm              Generate a Red Hat rpm package.
      --to-slp              Generate a Stampede slp package.
  -l, --to-lsb              Generate a LSB package.
  -t, --to-tgz              Generate a Slackware tgz package.
     Enables these options:
       --description=<desc> Specify package description.
       --version=<version>  Specify package version.
  -p, --to-pkg              Generate a Solaris pkg package.
  -i, --install             Install generated package.
  -g, --generate            Generate build tree, but do not build package.
  -c, --scripts             Include scripts in package.
      --target=<arch>       Set architecture of the generated package.
  -v, --verbose             Display each command alien runs.
      --veryverbose         Be verbose, and also display output of run commands.
  -k, --keep-version        Do not change version of generated package.
      --bump=number         Increment package version by this number.
  -h, --help                Display this help message.
  -V, --version         Display alien's version number.