估计阅读时长: 6 分钟
CentOS查看系统版本信息
cat /etc/redhat-release
# CentOS Stream release 8
cat /proc/version
# Linux version 4.18.0-489.el8.x86_64 (mockbuild@x86-05.stream.rdu2.redhat.com) (gcc version 8.5.0 20210514 (Red Hat 8.5.0-19) (GCC)) #1 SMP Thu Apr 27 17:02:11 UTC 2023
uname -a
# Linux iZj6cfl6qeqemcb1tyvvzrZ 4.18.0-489.el8.x86_64 #1 SMP Thu Apr 27 17:02:11 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
CentOS上安装Apache服务器
yum install httpd

systemctl start httpd
systemctl status httpd
systemctl restart httpd
systemctl reload httpd

在Centos的Docker容器中运行apache服务的时候,可能会遇到错误:

Failed to get D-Bus connection: No such file or directory

这个时候在镜像启动的命令行上加上--privileged=true即可解决问题。在windows上使用docker的时候,还需要添加双引号,否则镜像的id会被解析错。在成功完成容器的启动之后,可以从下面的文件夹之中查找得到apache的配置文件:

pwd
# /etc/httpd
ls -l
# total 12
# drwxr-xr-x 2 root root 4096 May 26 14:06 conf
# drwxr-xr-x 2 root root 4096 May 26 14:07 conf.d
# drwxr-xr-x 2 root root 4096 May 26 14:07 conf.modules.d
# lrwxrwxrwx 1 root root   19 May 26 14:06 logs -> ../../var/log/httpd
# lrwxrwxrwx 1 root root   29 May 26 14:06 modules -> ../../usr/lib64/httpd/modules
# lrwxrwxrwx 1 root root   10 May 26 14:06 run -> /run/httpd
# drwxrwxrwx 1 root root 4096 May 25 14:58 vhost

相关的日志文件,例如错误日志,一般可以在/var/log/httpd/文件夹中找得到:

ls -l /var/log/httpd/
# total 12
# -rw-r--r-- 1 root root    0 May 26 14:22 access_log
# -rw-r--r-- 1 root root 2710 May 26 14:53 biocad_access.log
# -rw-r--r-- 1 root root 1563 May 26 14:53 biocad_error.log
# -rw-r--r-- 1 root root 3011 May 26 14:52 error_log
在CentOS 7的Docker镜像中安装php8

CentOS 7的维护周期在2024年6月截止,理论上下面的命令在这个日期之后应该失效了

yum install epel-release

yum -y install yum-utils https://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum update -y
yum-config-manager --enable remi-php81
yum repolist

yum -y install php php-{cli,fpm,mysqlnd,zip,devel,gd,mbstring,curl,xml,pear,bcmath,json,opcache,redis,memcache}
在Ubuntu 2204服务器上安装php8+apache

在Ubuntu 2204版本的服务器系统上,php8并不存在于Ubuntu的默认软件源之中,我们需要额外的添加ondrej/phpPPA源才行:

apt-get install software-properties-common -y
add-apt-repository ppa:ondrej/php
apt-get update -y

完成了上面的步骤之后,我们就可以进行php8的安装操作了:

apt-get install apache2 php8.0 libapache2-mod-php8.0 -y
# php extensions
apt-get install php8.0-common php8.0-mysql php8.0-xml php8.0-curl php8.0-gd php8.0-imagick php8.0-cli php8.0-dev php8.0-imap php8.0-mbstring php8.0-opcache php8.0-soap php8.0-zip -y

systemctl restart apache2

在Ubuntu上,php的配置文件位置在:

vim /etc/php/8.0/apache2/php.ini

MySQL笔记

MySQL按照日期统计数量

SELECT date_format(add_time, '%Y-%m-%d') as date, count(*) as count
FROM tableName
GROUP BY date_format(add_time, '%Y-%m-%d')
ORDER BY date_format(add_time, '%Y-%m-%d')
;

MySQL进行字符串操作

现在在所建立的MySQL数据库之中,有小部分的数据基因id存在有一些文本解析的原因带来的异常,例如下面所示

那么在这里就会需要使用到两个MySQL的字符串函数来处理这些错误解析结果了,例如gene_id存在有异常的右括号需要做删除,gene_name存在有异常缺失的右括号需要做补充。那上面提到的两个字符串解析错误,可以分别通过Replace和CONCAT字符串操作函数来实现:

UPDATE `cad_registry`.`motif_sites`
SET
    `gene_id` = REPLACE(`gene_id`, ')', ''),
    `gene_name` = CONCAT(`gene_name`, ')')
WHERE
    gene_id LIKE '%)';

成功解决问题:

谢桂纲
Latest posts by 谢桂纲 (see all)

Attachments

  • R-C • 90 kB • 129 click
    12.04.2023

  • Capture • 60 kB • 69 click
    28.05.2023

  • Solved • 15 kB • 70 click
    28.05.2023

2 Responses

  1. 查询字符串以[“起始,以”]结尾:

    SELECT
    *
    FROM
    biodeepdb_full.metabolite
    WHERE
    INSTR(name, ‘[“‘) = 1
    AND INSTR(name, ‘”]’) = LENGTH(name) – LENGTH(‘”]’) + 1
    ORDER BY add_time DESC;

    来自江苏
  2. 删除mysql表中重复的行数据

    “`
    delete t1 from metabolite t1
    where t1.id in (select t2.id
    from (select id, `name`, formula, hashcode2, row_number()
    over(partition by `name`, formula, hashcode2 order by id) as rn
    from metabolite) t2
    where t2.rn 1);
    “`

    来自江苏

Leave a Reply

Your email address will not be published. Required fields are marked *

博客文章
April 2024
S M T W T F S
 123456
78910111213
14151617181920
21222324252627
282930  
  1. 空间Spot结果在下载到的mzkit文件夹中有示例吗?我试了试,不是10X结果中的tissue_positions_list.csv(软件选择此文件,直接error);在默认结果中也没找到类似的文件;